Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old May 12th, 2006, 03:45 AM
samir.kuthiala@gmail.com
Guest
 
Posts: n/a
Default suppress login dialog with XMLHttpRequest object & NTLM auth

I do some requests in the background on a page using the XMLHttpRequest
object. My site uses NTLM Authentication. However if the user is not
logged in, it throws up an ugly dialog box. Is there any way to
suppress this? I am ok with the object throwing an error which I can
catch.

What I want to do is to make a request. Instead of it popping up a
dialog box, I want to be able to suppress this dialog and instead
forward him to a separate login page.

Thanks

  #2  
Old May 12th, 2006, 08:56 AM
Bart Van der Donck
Guest
 
Posts: n/a
Default Re: suppress login dialog with XMLHttpRequest object & NTLM auth

samir.kuthiala@gmail.com wrote:
[color=blue]
> I do some requests in the background on a page using the XMLHttpRequest
> object. My site uses NTLM Authentication. However if the user is not
> logged in, it throws up an ugly dialog box. Is there any way to
> suppress this? I am ok with the object throwing an error which I can
> catch.
>
> What I want to do is to make a request. Instead of it popping up a
> dialog box, I want to be able to suppress this dialog and instead
> forward him to a separate login page.[/color]

See

http://jibbering.com/2002/4/httprequest.html

Just request the header in stead of the full page:

xmlhttp.open("HEAD", "/aDir/aPage.htm",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert(xmlhttp.getAllResponseHeaders())
}
}
xmlhttp.send(null)

Then check the returned HTTP numeric status code whether NTLM
Authentication is required or not:

HTTP/1.1 200 OK
[...headers...]

I believe that this status code would be 401.2 when the message should
be negotiated using NTLM authentication.

Then replace your current location to the login page depending on that
status code.

I'm not sure you can use getResponseHeader('headername'); because the
returned status code is actually not a part of the headers.

Hope this helps,

--
Bart

  #3  
Old May 12th, 2006, 10:35 AM
Bart Van der Donck
Guest
 
Posts: n/a
Default Re: suppress login dialog with XMLHttpRequest object & NTLM auth

Bart Van der Donck wrote:
[color=blue]
> samir.kuthiala@gmail.com wrote:
>[color=green]
> > I do some requests in the background on a page using the XMLHttpRequest
> > object. My site uses NTLM Authentication. However if the user is not
> > logged in, it throws up an ugly dialog box. Is there any way to
> > suppress this? I am ok with the object throwing an error which I can
> > catch.
> >
> > What I want to do is to make a request. Instead of it popping up a
> > dialog box, I want to be able to suppress this dialog and instead
> > forward him to a separate login page.[/color]
>
> See
>
> http://jibbering.com/2002/4/httprequest.html
>
> Just request the header in stead of the full page:
>
> xmlhttp.open("HEAD", "/aDir/aPage.htm",true);
> xmlhttp.onreadystatechange=function() {
> if (xmlhttp.readyState==4) {
> alert(xmlhttp.getAllResponseHeaders())
> }
> }
> xmlhttp.send(null)
>
> Then check the returned HTTP numeric status code whether NTLM
> Authentication is required or not:[/color]

On second thought, the header request would perhaps also require this
NTLM authentication (thus still showing the authentication box). I'm
not sure it is possible to use XMLHttpRequest so that it only returns
the HTTP status code and nothing else.

--
Bart

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,338 network members.