简体   繁体   中英

JS Redirect to page w/ postback or cache

I have a webforms site that has 2 menus.

On a page you click a button, has some c# events fired by a webservice (ajax) then redirects you to another page with history.go(-1) . The only problem is that in the webservice I create a sesion that makes the menus switch, the default one hides and the other one shows. The menu switch in done in the Page_Load of the Master page.

My problem is that with history.go(-1) you get to the previous page, but the old menu is present instead of the new one. How can I fix it?

the problem is that the browser is not actually loading the previous page it is using the cached page. is there a reason you can not have both menus hidden and then decide what one to show client side? this way you can let the JS .ready take care of what menu to show and then you should get the desired results when using the history.go(-1).

This artical speakes to setting cookie from the server then checking in on the client. you could use something like this and then check the cookie to determine if the page was loaded from cache and then force a postback.

location.reload()

我的解决方法是在会话中添加previos链接,当我需要重定向w /缓存时,我重定向到另一个aspx页面,该页面将重定向到需要它的url参数上的depengind ...这是我更简单的方法可以...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM