ASP.net缓存aspx Pages [英] ASP.net caches aspx Pages

查看:72
本文介绍了ASP.net缓存aspx Pages的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个奇怪的问题:

ASP.net缓存我的aspx页面,代码不是输出。

For测试创建一个页面并将下面的内容插入到正文中:

<%= now.tostring%>

每次重新加载页面时都会显示正确的日期。


到目前为止一切顺利。现在我添加以下行:

< br> test12345


每次我实际上页面仍显示正确的时间,但上面的行

直到我重新启动服务器才会出现。


问题是aspx页面编译一次并存储在

临时ASP中.NET Files目录。当我改变一个站点时,直到我重新启动服务器才重新编译



我该怎么办?

解决方案

通过在.aspx页面中添加:< br> test12345,您还没有更改

代码,您是我改变了HTML。简单地使用

更改的HTML重新保存.aspx页面将使浏览器的页面请求更新页面。如果你的b $ b不是你的话,我的猜测是你的浏览器正在缓存页面,

而不是服务器。


当我更新我的网站中的任何CODE(代码在我的代码隐藏
文件中)时,我将需要重新编译我的程序集(无需重新启动服务器) />
虽然)。当我在.aspx页面中对HTML进行更改时,只需

即可重新保存页面。

" Thorsten Tarrach" <第******** @ gmx.de>在消息中写道

新闻:哦************** @ TK2MSFTNGP11.phx.gbl ...

你好,我有一个奇怪的问题:
ASP.net缓存我的aspx页面,代码不是输出。
为测试创建一个页面并将其插入到正文中:
<% = now.tostring%>
每次重新加载页面时都会显示正确的日期。

到目前为止一切顺利。现在我添加以下行:
< br> test12345

每次我实现时页面仍显示正确的时间,但直到我重新启动时才会显示上面的行
服务器。

问题是aspx页面编译一次并存储在
Temporary ASP.NET Files目录中。当我更改一个站点时,它不会重新编译,直到我重新启动服务器。

我该怎么办?





" Scott M." < S - *** @ BADSPAMsnet.net> schrieb im Newsbeitrag

新闻:e3 ************* @tk2msftngp13.phx.gbl ...

添加:< br> ; test12345到.aspx页面,你没有改变
代码,你已经改变了HTML。只需使用改进的HTML重新保存.aspx页面,就可以通过浏览器在页面请求中更新页面。如果你没有,我的猜测是你的浏览器正在缓存页面,而不是服务器。


你是对的。我更改HTML并保存它。

当我更新我的网站中的任何CODE(代码在我的
代码隐藏文件中)时,我将需要重新编译我的程序集(不需要重新启动服务器
)。当我在.aspx页面中对HTML进行更改时,只需简单地重新保存页面即可。




重新安装之前系统对我来说也是如此。

页面没有缓存在浏览器中,因为时间已经更新(你需要记住<%= now.tostring%> )。


如果我改变后面的代码并重新编译程序集,也会发生同样的事情。

新添加的代码被忽略了。问题是Temporary

ASP.NET Files文件夹没有改变。


你必须关闭你的浏览器和然后你会看到反映的新代码

。这是正确的行为。当IIS检测到程序集的较新版本

时,它将放弃缓存版本,只有当没有人再使用它时才会使用它。


简单地调用refresh是不够的,因为IIS可以通过你的会话ID告诉你b $ b你不是新用户并且它不想将新程序集应用到

你,因为你已经开始使用旧的会话。

Thorsten Tarrach <第******** @ gmx.de>在消息中写道

news:ut ************** @ tk2msftngp13.phx.gbl ...


" ; Scott M. < S - *** @ BADSPAMsnet.net> schrieb im Newsbeitrag
新闻:e3 ************* @tk2msftngp13.phx.gbl ...

通过添加:< br> test12345到.aspx页面,你没有改变
代码,你已经改变了HTML。只需使用
重新保存.aspx页面,更改后的HTML将使浏览器在页面请求中更新页面。如果你不是,我的猜测是你的浏览器缓存
页面,而不是服务器。



你是对的。我更改HTML并保存它。

当我更新我的网站中的任何代码时(代码在我的


代码隐藏

file),我需要重新编译我的程序集(不需要重新启动
服务器)。当我在.aspx页面中对HTML进行更改时,只需简单地重新保存页面即可。



在我重新安装系统之前是真的对我来说也是如此。
页面没有缓存在浏览器中,因为时间已经更新(你记得<%= now.tostring%>)。

同样的事情如果我改变后面的代码并重新编译程序集就会发生。
新添加的代码被忽略了。问题是Temporary
ASP.NET Files文件夹没有改变。



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?

解决方案

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.
"Thorsten Tarrach" <th********@gmx.de> wrote in message
news:Oh**************@TK2MSFTNGP11.phx.gbl...

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?




"Scott M." <s-***@BADSPAMsnet.net> schrieb im Newsbeitrag
news:e3*************@tk2msftngp13.phx.gbl...

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.


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.
"Thorsten Tarrach" <th********@gmx.de> wrote in message
news:ut**************@tk2msftngp13.phx.gbl...


"Scott M." <s-***@BADSPAMsnet.net> schrieb im Newsbeitrag
news:e3*************@tk2msftngp13.phx.gbl...

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.



这篇关于ASP.net缓存aspx Pages的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆