In ASP.NET, by configuring it in Web.config:
Authentication>
Authorization>
You can access the REDIRECT to the Login.aspx page of any page to any page, in Login.aspx, can be redirected to the original page via the FormsAuthentication.RedirectFromLoginPage.
But sometimes you need to guide users to other pages.
Two methods:
The first is to use FormSauthentication.seTauthCookie, then write code redirect to other pages.
There is also a method, redirectFromLoginPage is actually redirecting the page based on ReturnURL = ... in the URL, we know that you can access this value via this.Request.QueryString ["ReturnURL"], but actually uses to throw an exception, discovery The reason is due to the querystring collection is read-only.
So we take the following measures:
PropertyInfo Info;
INFO = Request.queryString.gettype (). GetProperty ("isreadonly", bindingflags.nonpublic | bindingflags.instance;
IF (info! = null) info.setValue (this.Request.QueryString, False, NULL);
Request.QueryString ["ReturnURL"] = "Custom.aspx";