RE: 401 with Forms Authentication and Roles



Thanks for your followup Chuck,

As for the following question you mentioned:

===========
Say to change the logged in user to a
different user, you would also get redirected.
===========

In my login page, I can use "Request.QueryString["ReturnUrl"] != null" to
detect whether it is visited due to unauthorized, therefore, if you
manually or intentionaly visit the login page(there is no such a
querystring item), it won't automatically redirect you, doesn't it?


protected void Page_Load(object sender, EventArgs e)
{

if (Context.User.Identity.IsAuthenticated == true &&
Request.QueryString["ReturnUrl"] != null)
{
Server.Transfer("~/AccessDeniedPage.aspx");
}
..................
<<<<<<<<<<<<<<<<<<<<<<

Anyway, glad that you've got it working and thanks for sharing your
experience.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.


.



Relevant Pages

  • Re: this.GetWebRequest() returns null
    ... and also thanks for sharing the result to us. ... Steven Cheng ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Problem opening aspx source/designer in Vista
    ... I'm glad that you've found means to resolve the problem. ... sharing the result with us. ... Steven Cheng ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.vsnet.general)