question about Temporary ASP.NET Files folder

G

Guest

My dll file is copied to the
"%windir%\Microsoft.NET\Framework\{version}Temporary ASP.NET Files" folder
when I compile my asp.net project. When I run the application. The dll under
this folder is loaded, not the one under bin folder. Why is that? How can I
load the one under bin folder?
 
K

Karl

I believe, and hopefully someone will correct me if I'm wrong, the dll's in
your bin folder are those of your .cs/.vb files (codebehind, custom
classes..) as well are resource files and anything else embedded. The .dll
in the temp folder is created dynamically for the aspx files (the ones with
all the html in them). you can't change this behaviour. In 2.0, you'll
have 4 different types of compilation, one of which is what you want.

Karl
 
S

Scott Allen

Hi Roy:

I believe the ASP.NET team was trying to reduce the number of
scenarios where you have to restart the web application.


If ASP.NET loaded the DLL from the bin folder, the DLL would become
locked. The only way to update the DLL would be to stop the web
application to release the lock and then copy in the new DLL.

The way it works now is ASP.NET makes a shadow copy of the DLLs in the
bin directory. If you slide in a new version ASP.NET will detect the
new file, shadow copy and load it up.

HTH,
 
G

Guest

I can understand the reason you gave. But it confuses me more since it
complecates the deployment. I have a subfolder with some resource files under
it. This folder is relative to the bin folder, which means I can get the
folder dynamically from my assembly dll under bin folder. If the dll loaded
is the one under temporary folder, I cannot use XCopy to deploy my project.
How can I resolve it?
 
S

Scott Allen

Hi Roy:

Ah! You could just use the MapPath method to get the path to the file.
.. You pass MapPath a virtual path and it will return the physical path
to a file.

If I put:
string s = Server.MapPath("bin/a.bmp");

My result is:

"E:\dev\xprmnt\aspnet\Calendar\bin\a.bmp"


Note: you can also use HttpContext.Current.Server.MapPath if you are
in a class library outside of a web form.

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top