ASP.NET code not wortking with IIS

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?
 
M

Mike

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,591
Members
45,102
Latest member
GregoryGri
Top