|
Hello,
I'm using WebDeployment to deploy (to install) an intranet web application. I compile all aspx.cs class to one DLL. I have 2 more DLL that are personal libray and that are used by my application. So, I have actually 3 DLL. I would like to use NGEN to create DLL in native code during project installation.
NGEN INSTALL MYDLL1.DLL
NGEN INSTALL MYDLL2.DLL
NGEN INSTALL MYDLL3.DLL
Could you tell me how to use NGEN with WebDeployment Project to register my three DLL ? Have I to add command line in project file (XML) - witch section ?
Second point: I would like also to use Dotfuscator community 3.0 with WebDeployment - if you have an article on the subject it would be great ! I have tried by when method are renamed to aa, bb, cc. the application don't found anymore the methods of my project...
Regards,
La Richesse & la Gloire ne griseront jamais que les temples
|
|
|
|
|
Merlin Tintin wrote: I would like to use NGEN to create DLL in native code during project installation.
Why do you want to do this? There are very specific reasons for deploying NGEN'd assemblies and specific problems they solve. It's not a general purpose "hammer".
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
I agree with Scott here. I can't think of any good reason to use NGEN on a web app.
All NGEN does is pre-JIT the IL to native assembly. This has lots of implications as it means the CLR can no longer run optimisations as it jits. The CLR is very effcient, it can often optimise things as it goes along because it knows the context it is running in. By using NGEN you remove that optimisation.
The normal performance benifit associated with NGEN is improved cold start up times as the CLR doesn't have to jit compile methods before it can run them. Once the app is started though, the CLR caches jit compiled stuff so it doesn't have to do it again. By the very nature of a web app, cold start up time is irrelevant, it is just continuously running, so only the very first user will experience any slow down related to jitting, after that, the assembly is cached and no more jit compilation is required.
Simon
|
|
|
|
|
I agree with you for optimization - but optimization is not my main goal. My main goal is to protect the embeded code of my page and the framework that I put on the client server. My application is installed on all over the world on server that are the property of clients. So, I would like to use NGEN to put my code less (easier) readable.
Fo that I have a plan. Each point is pretty simple to complete but the whole thing is more difficult because each feature is not predict to use other.
Here is my steps to protect the .NET code (as strong as possible)
- sign the assembly
- All code of pages are in not single class but in a global DLL. This is realize with WebDeploymentProject
- Compile in native code (NGEN). Put the code less readeable for decompilation.
- Obfusacte the code with Dotfuscator Community 3.0
I realize each step without any problem but I cannot figure out how to implement everything together.
ps: I have a click one install to install the web application.
I hope this is more clear for you and I'm open to any other suggestion to protect the code efficiently.
La Richesse & la Gloire ne griseront jamais que les temples
|
|
|
|
|
NGEN is meant to improve startup-time, it's not meant to protect your code.
AFAIK there's no way to use an NGEN image on its own, you must also ship the original .NET assembly.
|
|
|
|
|
Ahh, I see. Interesting Idea, but unfortunately that won't work.
NGEN takes your IL assembly and compiles it to processor specific machine code, and places this machine code in a native image cache on the PC that NGEN was run on. You can't then copy this machine code onto another PC. You also can't delete the original IL assembly as that will also delete the machine code from the native image cache.
What happens when you run your app then is the CLR first checks the native image cache to see if it's already been compiles, if it finds stuff in the cache it uses that.
running NGEN on an assembly gives you no extra protection from disassembly. It can still be disassembled and reflected on. All the meta data included with a normal assembly is still present.
If you are concerned with clients seeing your code your only real option is an obfuscater.
(Signing the assembly does not prevent it being viewed, it only means other people can identify it as your work. Other people can even still change it, but if they change 1 assembly, they have to recompile them all as signing with a strong name ensures other assemblies will only call the original one they were referenced to.)
Ultimately, C# (even with an obfuscater) is not 100% foolproof at hiding code. If you have critical proprietary algorithms that must be hidden, most people would recommend implementing the critical bits in unmanaged code.
Simon
|
|
|
|
|
Hello,
I have written a method to process shortcut entries in my main form that simply dispatches messages to related methods for the button presses. But my problem is that when Key.Left or Key.Right is pressed for the "first" time, KeyDown event is not triggered for my following method:
KeyPreview property of main form is set to true,
private void shortcutKeyDown(object sender, KeyEventArgs e)
{
if (!e.Control && !e.Alt && !e.Shift)
{
switch (e.KeyCode)
{
case (Keys.Left):
{
CallRelatedMethod(this, e);
break;
}
case (Keys.Right):
{
CallRelatedMethod(this, e);
break;
}
case (Keys.E):
{
CallRelatedMethod(this, e);
break;
}
case (Keys.W):
{
CallRelatedMethod(this, e);
break;
}
case (Keys.P):
{
CallRelatedMethod(this, e);
break;
}
default:
break;
}
}
}
Test Notes:
Other keys "W, E, P" triggers the Keydown event without any problems.
When Left or Right key is pressed for the second time Keydown event is triggered.
Could not find similar problems in google or here so probably I am missing a simple point but I cannot see.
Any help is appreciated.
Thank you,
|
|
|
|
|
Maybe you should write in FormKeyDown event or if you can try to catch windows keypresses.
|
|
|
|
|
i modify your code to :
if (e.Control || e.Alt || e.Shift) return;
switch (e.KeyCode)
{
case (Keys.Left):
{
CallRelatedMethod(this, e);
break;
}
case (Keys.Right):
{
CallRelatedMethod(this, e);
break;
}
case (Keys.E):
{
CallRelatedMethod(this, e);
break;
}
case (Keys.W):
{
CallRelatedMethod(this, e);
break;
}
case (Keys.P):
{
CallRelatedMethod(this, e);
break;
}
default:
break;
}
hope it help
dhaim
program is hobby that make some money as side effect
|
|
|
|
|
Thank you for your time guys,
With your approach to the method here are some more details:
- I have assigned this method to every control that can have focus. (I have only a toolbar and a form thats all.)
(Subscribed to form, toolbar keyDown events.)
- dhaim, thank you for your modification but unfortunately I dont have a problem as the code does not run in the if() statement. When I debug the code and insert a break to the beginning of the method, I saw that the Keydown event is not triggered when I first press left or right button. Which means the method is never executed although a keydown event occurs.
Thank you again, for your precious time.
|
|
|
|
|
some controls takes the control when you focused. you must lostfocus before catch the keypress.
like webBrowser, datagridview.
You must override theirs events..
|
|
|
|
|
I have tested your suggestion and I am pretty sure that main form has the focus when the program is first executed and left/right arrow is pressed as a shortcut.
Thank you,
|
|
|
|
|
yes sir, I found your problem
use FormKeyUp event. It works for all.
also here is a simple sample.
private void frmMain_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyValue == 114)
SendKeys.Send("^{TAB}");
if (e.KeyValue == 115)
SendKeys.Send("^+{TAB}");
}
|
|
|
|
|
Even if I use KeyUp or KeyDown event the result does not change. Issue is still there.
When I debug the code and insert a break to the beginning of the method, I saw that the Keydown/KeyUp event is not triggered when I first press left or right button. Which means the method is never executed although a keydown/KeyUp event occurs.
I think I am missing something different than catching the pressed key because when I press the left/right twice everything work just fine.
Thank you Engin,
|
|
|
|
|
it's working for me, strange
event is triggered when I first press left or right and for all buttons.
I don't know "why", sorry
|
|
|
|
|
Hello everyone,
I am writing a simple client which downloads Pages from Http Web site. Sometimes I received errors like 502 or 503 (Http error code), and I am wondering,
- What do they mean?
- Are they pure server side issue? Or I could improve by adding some additional information to my Http request (e.g. provide user name and password, provide locale information?)
thanks in advance,
George
|
|
|
|
|
502 is a bad gateway error. This occurs when the server which you are requesting is getting data from another server and some problem happened on that response. See here[^] for HTTP error codes and definitions.
|
|
|
|
|
Thanks N a v a n e e t h,
I found the description for 502 is very brief in the page. Could you describe,
1. Some normal scenarios when 502 will happen?
2. Is it client side or server side issue?
3. What means "The server, while acting as a gateway or proxy"? I am accessing some URL, it should be the exact web server, why it acts as gateway or proxy?
regards,
George
|
|
|
|
|
George_George wrote: Is it client side or server side issue?
It's a server side issue. Don't know the scenarios in which it appears.
George_George wrote: What means "The server, while acting as a gateway or proxy"? I am accessing some URL, it should be the exact web server, why it acts as gateway or proxy?
Sometimes the server you are giving request is not the server which gives you output. Your server will give request to another one and if anything wrong in that response, 502 is returned. Some servers will be proxy servers which just routes the request to another server.
|
|
|
|
|
Great and thanks N a v a n e e t h!
1.
Why they use some servers acting as gateway/proxy? For performance or security reasons? Or something else?
2.
I think 503 means error from the exact server/URL we are requesting, and 502 means error from the not the server/URL we are requesting, i.e. a gateway or proxy? Could I understand in this way?
regards,
George
|
|
|
|
|
George_George wrote: I think 503 means error from the exact server/URL we are requesting
Not the exact URL no. Exact URL can mean any number of things. Not all server side technologies are equal. Similar perhaps but not equal. The actual problem should be of no consideration to a client application. The actual problem is only of interest to someone attempting to solve the problem on the server and the problem diagnosis will be specific to the server software being used.
led mike
|
|
|
|
|
Sorry led mike, I have not made question clear enough. I am not developing server side application, but writing an Http client to request some pages for data to use.
My question is, if at Http client side, there is 502 or 503 error, how could the client improve itself to reduce some error? I am not sure whether it is caused by missing some Http session/cookie/headers?
regards,
George
|
|
|
|
|
1 - I don't think that there is perfromance benefits. One example of why it is used would be to organize things. So a user can request for books to a proxy server and proxy knows where to find the information and it redirects the request to there. Proxy servers usually alters the original request they got. When these servers are just redirecting the request to another one, it's called as gateway, not proxy.
2 - No. 503 is shown when server is overloaded or when it just refuses the connection.
|
|
|
|
|
Thanks N a v a n e e t h,
1.
You mean gateway is served as redirection purpose and proxy is served as performance improvement purpose?
2.
N a v a n e e t h wrote: No. 503 is shown when server is overloaded or when it just refuses the connection.
I agree it is one reason why server returns 503, but is it the only reason? Do you have any documents to support your claim?
regards,
George
|
|
|
|
|
1 - If a server just redirects the request to another server, it is gateway. When server alteres the request and pass that to another server, it is proxy. There is no performance considertations, AFAIK.
2 - Yeah, W3C tells this is the reason. You can find the defnition in the URL which I given in an earlier post.
|
|
|
|