Hello,
I am working on a project in Visual Studio 2003 that consists of two applications one is in
VB and the other is in C#. When a user login a cookie is created and used by the second application (C#). The problem is that if I want to login under a different ID & password than I have to manually delete the cookies (go to IE-option-delete cookies/cache) and than only can I login as a different user without closing the IE. What I am doing to fix the problem is by linking a LOGOUT hyperlink to a new page (LogoutPage.aspx) that has the following code:-
(Language C#)
namespace SubmissionClearance
{
public class LogoutPage : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
FormsAuthentication.SignOut();
Response.Redirect("../Agents/FormsLogin.aspx",true);
}
}
}
(Language
VB)
Public Class LogoutPage
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FormsAuthentication.SignOut()
Response.Redirect("~/Agents/FormsLogin.aspx", True)
End Sub
End Class
(here is the code (HTML) for the hyperlink to link to logout page)
<A runat="server" class="leftMainLinkCell" onmouseover="return overlib('Click here to Logout.')" onmouseout="nd();" href="~/Agents/LogoutPage.aspx">Logout</A>
But I am getting an error: something saying that namespace name FormsAuthentication�
I also added <%@ Import Namespace = "System.Web.Security"%> but still get the error
I was wondering if this is the right way to do it or is there a better way?
(Note: I was searching online and read that it is better to use page_load event than button_click)
Thanks a lotâ¦for yr time & helpâ¦appreciate it!