|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
HTTP Auth problem
HTTP authenticate (username and password box) that appears when you go to the page. I know that you can do this (using PHP or CGI) but I'm not sure how to do this in asp. An example of a page that does do this (just to prove I'm not talking rubbish) is: http://web-sniffer.net/index.php which does exactly what I'm on about. I know how to do this in PHP using: if ($PHP_AUTH_USER != "user" or $PHP_AUTH_PW != "pass"): // Bad or no username/password. // Send HTTP 401 error to make the // browser prompt the user. header("WWW-Authenticate: " . "Basic realm=\"Protected Page: " . "Enter your username and password " . "for access.\""); header("HTTP/1.0 401 Unauthorized"); But how do I do this in Classic ASP? I'm assuming that i've got to set the headers when I go to get the page but how? Regards Neil Take a look here for how to access the remote site.
http://www.aspfaq.com/show.asp?id=2173 Now, to adapt that for authentication, try: XMLHTTP.Open "Get", URL, False, "username", "password" 'not tested Ray at work Show quote "Neil Hitchmough" <nhitchmo***@yahoo.co.uk> wrote in message news:6fec5ad4.0502230502.6d7e1591@posting.google.com... > I want to access a page on a remote webserver that is protected by > HTTP authenticate (username and password box) that appears when you go > to the page. > > I know that you can do this (using PHP or CGI) but I'm not sure how to > do this in asp. > > An example of a page that does do this (just to prove I'm not talking > rubbish) is: http://web-sniffer.net/index.php which does exactly what > I'm on about. > > I know how to do this in PHP using: > > if ($PHP_AUTH_USER != "user" > or $PHP_AUTH_PW != "pass"): > // Bad or no username/password. > // Send HTTP 401 error to make the > // browser prompt the user. > header("WWW-Authenticate: " . > "Basic realm=\"Protected Page: " . > "Enter your username and password " . > "for access.\""); > header("HTTP/1.0 401 Unauthorized"); > > But how do I do this in Classic ASP? I'm assuming that i've got to set > the headers when I go to get the page but how? > > Regards > > Neil |
|||||||||||||||||||||||