简体   繁体   English

如何清除asp.net设计源文件中的会话变量

[英]How to clear the session variable in asp.net design source file

Session["pageIndex"] this is my variable which is used in all aspx.cs pages Session [“ pageIndex”]这是我在所有aspx.cs页面中使用的变量

I used 我用了

$('#btn_click').click(function(){
sessionStorage.removeItem('pageIndex');
)}; 

to clear the session variable in design source file but it doesn't works 清除设计源文件中的会话变量,但不起作用

help me thanks in advance 提前帮我谢谢

I recommend you throw the page number into the query string, then in the Page_Load event, you check for it. 我建议您将页码放入查询字符串中,然后在Page_Load事件中进行检查。 If its there, you go to that page directly, otherwise you load the first page. 如果存在,则直接转到该页面,否则将加载第一页。

This should support browser back button functionality taking you to the correct page. 这应该支持浏览器后退按钮功能,将您带到正确的页面。

The issue you're experiencing is that ASP.NET is letting you change the page content without changing the url. 您遇到的问题是ASP.NET允许您更改页面内容而不更改url。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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