|
 |
asp_web_howto thread: WWW-Authenticate
Message #1 by "Tai Vu" <tai.vu@u...> on Thu, 5 Dec 2002 22:53:53
|
|
Hi,
I'm trying to use WWW-Authenticate in my codes to prompt for the network
username/password but the logon dialog keeps prompting 3 times for the
username/password eventhough the credential supplied each time is correct.
Code:
Response.Buffer = True
Response.Status = "401 Unauthorized"
Response.AddHeader "WWW-Authenticate", "BASIC"
Is this a feature or am i doing something wrong?
Any helps are greatly appreciated.
Tai.
Message #2 by "phil griffiths" <pgtips@m...> on Fri, 6 Dec 2002 09:52:45
|
|
Tai, you haven't included any other code so I'm just guessing here - are
you checking whether you actually have the credentials before sending
these headers? If not then that will be causing your problems. This is
the code I use in these circumstances:
If Len(Trim(Request.ServerVariables ("LOGON_USER"))) = 0 Then
Response.Status = "401 Unauthorized"
Response.AddHeader "WWW-Authenticate", "NTLM"
Response.End
End If
I use "NTLM" instead of Basic - this causes the browser to automatically
send the network logon without prompting the user at all (assuming this is
intranet). If you need to use Basic instead, then I think the user name
comes in Request.ServerVariables("AUTH_USER"), but I'm not 100%.
hth
Phil
>----------------------------------------------
> Hi,
> I'm trying to use WWW-Authenticate in my codes to prompt for the network
u> sername/password but the logon dialog keeps prompting 3 times for the
u> sername/password eventhough the credential supplied each time is
correct.
> Code:
> Response.Buffer = True
> Response.Status = "401 Unauthorized"
> Response.AddHeader "WWW-Authenticate", "BASIC"
> Is this a feature or am i doing something wrong?
> Any helps are greatly appreciated.
> Tai.
Message #3 by "Ken Schaefer" <ken@a...> on Sat, 7 Dec 2002 20:35:17 +1100
|
|
How are you entering your credentials? Are you using DOMAIN\User syntax?
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Tai Vu" <tai.vu@u...>
Subject: [asp_web_howto] WWW-Authenticate
: I'm trying to use WWW-Authenticate in my codes to prompt for the network
: username/password but the logon dialog keeps prompting 3 times for the
: username/password eventhough the credential supplied each time is correct.
:
: Code:
:
: Response.Buffer = True
: Response.Status = "401 Unauthorized"
: Response.AddHeader "WWW-Authenticate", "BASIC"
:
: Is this a feature or am i doing something wrong?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #4 by "Tai Vu" <tai.vu@u...> on Fri, 13 Dec 2002 06:31:02
|
|
Hi Phil/Ken,
Thanks for both your helps on this issue, i am actually steering away from
Basic/NTLM and use database authentication instead.
Regards
Tai.
> Tai, you haven't included any other code so I'm just guessing here - are
y> ou checking whether you actually have the credentials before sending
t> hese headers? If not then that will be causing your problems. This is
t> he code I use in these circumstances:
I> f Len(Trim(Request.ServerVariables ("LOGON_USER"))) = 0 Then
> Response.Status = "401 Unauthorized"
> Response.AddHeader "WWW-Authenticate", "NTLM"
> Response.End
E> nd If
> I use "NTLM" instead of Basic - this causes the browser to automatically
s> end the network logon without prompting the user at all (assuming this
is
i> ntranet). If you need to use Basic instead, then I think the user name
c> omes in Request.ServerVariables("AUTH_USER"), but I'm not 100%.
> hth
P> hil
>> ----------------------------------------------
>> Hi,
> > I'm trying to use WWW-Authenticate in my codes to prompt for the
network
u> > sername/password but the logon dialog keeps prompting 3 times for the
u> > sername/password eventhough the credential supplied each time is
c> orrect.
> > Code:
> > Response.Buffer = True
> > Response.Status = "401 Unauthorized"
> > Response.AddHeader "WWW-Authenticate", "BASIC"
> > Is this a feature or am i doing something wrong?
> > Any helps are greatly appreciated.
> > Tai.
|
|
 |