Return to
HomePageASPNET2SecurityFAQs
Question: How do I strong name an ASP.NET application?
Answer:
You can strong name an ASP.NET application by pre-compiling the application and signing it with a strong name key. You can pre-compile and strong name ASP.NET application using either Visual Studio .NET 2005 or aspnet_compiler.exe, a command line utility. In both cases you will have to create a strong name key pair file using Strong Name (Sn.exe) utility.
Note: You can not use the password protected strong name key pair file (.pfx)
Strong naming .NET Application provides strong integrity check and can be used with strong named assemblies without needing the strong name assembly to have APTCA attribute on them.
Using Visual Studio 2005 * In the
Build option from the tool menu select
Publish http://localhost/.... * On the
Publish Web Site dialog box, enter the
Target Location where you want the deployable precompiled site to be copied
* Select the
Enable strong naming on precompiled assembly checkbox
* Select the
"Use a key file generated with Strong Name tool" or
"Use a Key Container" radio button depending upon where your strong name key pair is stored.
* If you choose
"Use a key file generated with Strong Name tool" enter the
"Key file location" and click
OkThis will pre-compile the ASP.NET application and strong name it, you can
XCopy the complete folder from the target location and deploy it on your production server.
Using aspnet_compiler.exe command line utility * Open Visual Studio 2005 command Prompt
* Run the following command, specifying applications virtual path, target directory and strong name key pair file.
aspnet_compiler -v /<<ASP.NET Application Virtual path>> <<Target Directory Path>> -keyfile C:\test.snk
This will pre-compile the ASP.NET application and strong name it, you can
XCopy the complete folder from the target location and deploy it on your production server.
Return to
HomePageASPNET2SecurityFAQs