ASP.net caches aspx Pages

  • Thread starter Thorsten Tarrach
  • Start date
T

Thorsten Tarrach

Hallo,
I have a strange problem:
ASP.net caches my aspx pages, the code not the output.
For testing is created a page and inserted the folowing into the body:
<%=now.tostring%>
Every time I reload the page the correct date is shown.

So far so good. Now I add the following line:
<br>test12345

The page still shows the correct time everytime I realod, but the line above
does not appear until I restart the server.

The problem is that the aspx pages are compiles once and stored in the
Temporary ASP.NET Files directory. When I change one site it is not
recompiled until I restart the server.

What can I do?
 
S

Scott M.

By adding: <br>test12345 to the .aspx page, you have NOT changed the
"code", you've changed the HTML. Simply re-saving the .aspx page with the
altered HTML will make the page update in page requests by browsers. If
yours isn't, my guess is that it is your browser that is caching the page,
not the server.

When I update any of the CODE in my web site (code that is in my code-behind
file), I will need to recompile my assembly (no need to restart the server
though). When I make a change to the HTML in the .aspx page, simply
re-saving the page is all that is required.
 
T

Thorsten Tarrach

Scott M. said:
By adding: <br>test12345 to the .aspx page, you have NOT changed the
"code", you've changed the HTML. Simply re-saving the .aspx page with the
altered HTML will make the page update in page requests by browsers. If
yours isn't, my guess is that it is your browser that is caching the page,
not the server.

You are right. I change the HTML and save it.
When I update any of the CODE in my web site (code that is in my code-behind
file), I will need to recompile my assembly (no need to restart the server
though). When I make a change to the HTML in the .aspx page, simply
re-saving the page is all that is required.

Before I reinstalled the system that was true for me too.
The page is NOT cached in the browser because the time is updated (you
remember <%=now.tostring%>).

Same thing happens if I change the code behind and recompile the assembly.
The newly added code is simply ignored. The problem is that the Temporary
ASP.NET Files folder does not change.
 
S

Scott M.

You have to shut down your browser and then you will see the new code
reflected. This is the correct behavior. When IIS detects a newer version
of the assembly, it will abandon the cached version ONLY when no one is
using it any longer.

Simply calling refresh is not enough, since IIS can tell by your session ID
that you are not a NEW user and it doesn't want to apply the new assembly to
you, since you've already initiated a session using the old one.
 
T

Thorsten Tarrach

Hallo,
here comes the solution.
The problem was that the Inetpub was physically stored on d: and linked to
c:\inetpub which was used by all applications.
The aspnet process is obviously not able to trace changes I perform on
c:\inetpub.
Thorsten
 
S

Scott M.

You have an InetPub on your C and your D drives? Then you have 2
installations of IIS. One would not be "linked" to the other, but I'm
wondering how you can have IIS (a Windows service) installed twice?
 
T

Thorsten Tarrach

Scott M. said:
You have an InetPub on your C and your D drives? Then you have 2
installations of IIS. One would not be "linked" to the other, but I'm
wondering how you can have IIS (a Windows service) installed twice?

No, I just copied Inetpub com C to D and deleted the directory on C. Then I
created a Link on C pointing to D. It's not a simple link windows explorer
creates, but an NTFS junction which really causes programms to believe this
directory is stored on C.
Normally this works fine, but the aspnet process is obviously confused by
this construction.
 
B

Brian H

Why do it this way? So in IIS, it still looks like it's pointing to
c:\inetpub? Why not just change it to d:\ and remove this 'link'? I'm sure
you may have reasons for it, but it just seems like it would lead to
problems.

Brian
 
T

Thorsten Tarrach

Brian H said:
Why do it this way? So in IIS, it still looks like it's pointing to
c:\inetpub? Why not just change it to d:\ and remove this 'link'? I'm sure
you may have reasons for it, but it just seems like it would lead to
problems.

Yes, I changed it now.
Normally linking is the easiest way to avoid any problems after moving a
folder. For example after moving my whole user profile to d: and linking it
back to c:\documents... windows didn't notice the change.
 

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,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top