简体   繁体   English

为什么退出时会转到页面并在c#,mvc中按浏览器后退按钮

[英]why it goes to a page when signout and press browser back button in c#, mvc

I'm creating a login in c#, mvc. 我在c#,mvc中创建登录名。 it works fine. 它工作正常。 Sign out is also working properly. 退出也可以正常工作。 But after user signed out, if user press back button it goes to the page where I redirect if login success. 但是,在用户注销后,如果用户按“后退”按钮,则会转到登录成功后重定向到的页面。 I tried with following by adding it to global.asax.cs . 我尝试将其添加到global.asax.cs but it didn't work. 但这没用。 And also I tried using javascript. 而且我尝试使用javascript。 At that time if user press back button it shows the page and disappears. 那时,如果用户按返回按钮,它将显示该页面并消失。 What can I do for that? 我该怎么办?

This is how I tried with c# 这就是我尝试使用C#的方式

protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();

    WebApiConfig.Register(GlobalConfiguration.Configuration);
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);

}

protected void Application_BeginRequest()
{
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.Cache.SetExpires(DateTime.UtcNow.AddMilliseconds(-10));
    Response.Cache.SetNoStore();
}

please help me with this 请在这件事上给予我帮助

您无法清除用户历史记录,但是可以从成功登录后重定向用户的页面中添加未授权用户的重定向。

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

相关问题 在MVC Razor中注销后用户按“后退”按钮时,如何防止身份验证? - How to Prevent Authentication when User Press Back button after signout in MVC Razor? c#Web浏览器模拟按钮按下 - c# Web Browser simulate button press 按下浏览器的后退按钮时的呼叫页面加载事件 - Call page load event on browser's back button press 按“后退浏览器”按钮,失去上一页状态 - Press the Back Browser button loosing the previous page state 超时后,如何将用户重定向回退出页面? Asp.net MVC - How can I redirect a user back to signout page when timed out? Asp.net MVC 当我第二次按下按钮时,如果 C# 中的语句使文本框恢复正常 - if statements in C# for a textbox to change back to normal when i press a button for the second time 在C#中按按钮时运行项目 - Run project when press button in C# 在c#.net中注销后按浏览器后退按钮重新加载网页 - Reload the web page on pressing browser back button after logout in c# .net 将值从Button传递回ASP.NET MVC 3 Razor页面的C#控制器 - Pass Value from Button back to C# Controller from ASP.NET MVC 3 Razor Page C#:为什么当我在数据网格视图中按下删除按钮时,它没有从 arraylist 中删除数据? - C#: Why doesn't it delete the data from the arraylist when I press the delete button in the datagridview?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM