路由,重定向和页面加载 [英] Routing, Redirects and Page Load

查看:114
本文介绍了路由,重定向和页面加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我正在尝试在.net 4中使用新的路由.
1)在浏览器中输入特定的URL模式后,它会按计划路由到Default.aspx页面.
2)在Default.aspx的Page_Load中,它在会话中设置了一些信息,然后重定向到另一个页面(Edit.aspx).
3)Edit.aspx中的Page_Load具有一些可以按预期执行的代码.

现在,我的网址格式是:
routes.MapPageRoute("", "quote/{dealername}", "~/default.aspx");
所有这些都在Global.asax中很好地设置了

说,我输入浏览器的第一个URL是"quote/something".
这按预期工作.
但是,如果我然后在地址栏中输入"quote/somethingelse",则上面的第一点和第二点就可以了,但是在第三点时,Page_Load不会在Edit.aspx中触发.因此,它看起来就像我在地址栏中输入"something"时一样,而不是在"somethingelse"中那样.

我说得通吗?

我不知道为什么不能为Edit.aspx触发Page_Load.也许是在缓存一些东西.我不知道.我到处都看过Google.

任何帮助是极大的赞赏.谢谢:)

Hello,

I am trying to use the new routing in .net 4.

1) When a specific url pattern is entered into the browser it routes to the Default.aspx page as planned.
2) In the Page_Load of Default.aspx it sets up some information in session and then redirects to another page (Edit.aspx).
3) The Page_Load in Edit.aspx has some code in which executes as expected.

Now, my url pattern is this:
routes.MapPageRoute("", "quote/{dealername}", "~/default.aspx");
All set up nicely in Global.asax

Say, the first url I enter into the browser is "quote/something".
This works as expected.
But if I then put "quote/somethingelse" into the address bar, points one and two above happen just fine but when it comes to point three, the Page_Load does not fire in Edit.aspx. So it looks just as it did when I put "something" in the address bar instead of being as it should for "somethingelse".

Am I making sense?

I don''t know why the Page_Load does not fire for Edit.aspx. Perhaps it''s caching something. I''m not sure. I''ve looked all over Google.

Any help is greatly appreciated. Thanks :)

推荐答案

whadaya知道,这是古老的停止浏览器缓存"的把戏!
Well whadaya know, it was the old "stop the browser caching" trick!

<br />
<pre lang="xml"><meta http-equiv="Cache-Control" content="no-cache" /><br />
<meta http-equiv="PRAGMA" content="NO-CACHE" /><br />
<meta http-equiv="EXPIRES" content="-1" /></pre><br />


这篇关于路由,重定向和页面加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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