RedirectToLoginPage Method (String)
Collapse the table of content
Expand the table of content

FormsAuthentication.RedirectToLoginPage Method (String)


Redirects the browser to the login URL with the specified query string.

Namespace:   System.Web.Security
Assembly:  System.Web (in System.Web.dll)

public static void RedirectToLoginPage(
	string extraQueryString


Type: System.String

The query string to include with the redirect URL.

The RedirectToLoginPage method redirects the browser to the LoginUrl and includes the extraQueryString value as the QueryString for the redirected URL.

The RedirectToLoginPage method does not clear the forms-authentication cookie. You can use the RedirectToLoginPage method in conjunction with the SignOut method to log one user out and allow a different user to log in.

Legacy Code Example

The following code example clears the forms-authentication cookie using the SignOut method and redirects the user to the login page using the RedirectToLoginPage method.

Code snippet is not found. Confirm that the code snippet name 'System.Web.Security.FormsAuthentication' is correct.

.NET Framework
Available since 2.0
Return to top
© 2015 Microsoft