ASP.NET code not wortking with IIS

  • Thread starter Thread starter Mike Chilson
  • Start date Start date
M

Mike Chilson

Hi all,
Have an IIS authentication issue and need some help. I won't get into specific detail why we do it this way but we HAVE to do it this way. We have a login page in an asp.net web application that allows the user to choose to use windows integrated authentication or an application level authentication method (application controls accounts).
We are having a problem getting the following snippet of code to behave properly.



If Me.Authenticator.AuthenticationType = Authentication.AuthenticationType.WindowsIntegrated Then
With Response
Response.Clear()
.Buffer = True 'buffer until page is complete
.StatusCode = 401
.StatusDescription = "Unauthorized"
.AddHeader("WWW-Authenticate", "BASIC realm=""" & strDomain & """")
.End()
End With
End If

The problem is even if we have both Integrated and anonymous access checked, the code above does not work. It basically just blows through it like only anonymous is checked. Any ideas what is going on here?
 
Having anonymous checked will allow anyone to access the site (hence: anonymous). So your code below will never get executed. You should use one or the other, I never seen a site run under both.


Hi all,
Have an IIS authentication issue and need some help. I won't get into specific detail why we do it this way but we HAVE to do it this way. We have a login page in an asp.net web application that allows the user to choose to use windows integrated authentication or an application level authentication method (application controls accounts).
We are having a problem getting the following snippet of code to behave properly.



If Me.Authenticator.AuthenticationType = Authentication.AuthenticationType.WindowsIntegrated Then
With Response
Response.Clear()
.Buffer = True 'buffer until page is complete
.StatusCode = 401
.StatusDescription = "Unauthorized"
.AddHeader("WWW-Authenticate", "BASIC realm=""" & strDomain & """")
.End()
End With
End If

The problem is even if we have both Integrated and anonymous access checked, the code above does not work. It basically just blows through it like only anonymous is checked. Any ideas what is going on here?
 
Back
Top