更新时间:2023-12-02 13:47:34
使用
Response.Redirect("login.aspx"); /
如果有任何内容,请清除上一个会话
谢谢,
SP
如果您使用的是FormsAuthentication,请在注销"按钮上单击以编写以下代码Session.Clear(); Session.Abondon(); FormsAuthentication.SignOut(); Response.Redirect(" );
如果您不使用FormsAuthentication,则只需Session.Clear(); Session.Abondon(); Response.Redirect(" );将起作用.
FormsAuthentication.SignOut(); 会话[" ].Abandon(); Response.Redirect(" );
并在login.aspx页面加载事件中编写以下语句.
Response.Cache.SetNoStore();
它应该是页面加载事件中的第一声明.
如果您使用的是母版页,则在母版页加载事件中编写以上语句.
I would like to Logout the application in c#.net Windows application and login form should be opened at the time of Logout Can any one help
Use
Response.Redirect("login.aspx"); /
Clear previous session''s, if you have any
Thanks,
SP
hi, If you are using FormsAuthentication then on Logout Button click write the following codeSession.Clear(); Session.Abondon(); FormsAuthentication.SignOut(); Response.Redirect("Home.aspx");
and if you are not using FormsAuthentication then simplySession.Clear(); Session.Abondon(); Response.Redirect("Home.aspx");will work.
Write the followinglogout
code inlogout
button click eventFormsAuthentication.SignOut(); Session["Name"].Abandon(); Response.Redirect("Login.aspx");
and inlogin.aspxpage load event write the following statement.
Response.Cache.SetNoStore();
it should be the first statement in the page load event.
if you are using the master pages then write the above statement in the master page load event.