HTTP Auth problem

Discussion in 'ASP General' started by Neil Hitchmough, Feb 23, 2005.

  1. 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
     
    Neil Hitchmough, Feb 23, 2005
    #1
    1. Advertising

  2. 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

    "Neil Hitchmough" <> wrote in message
    news:...
    > 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
     
    Ray Costanzo [MVP], Feb 23, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Q2hyaXMgTW9oYW4=?=

    Configuring Windows Auth & Forms Auth in Asp.Net

    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=, Apr 28, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    765
    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=
    Apr 28, 2004
  2. =?Utf-8?B?ZGhucml2ZXJzaWRl?=

    Windows Auth, but Forms Auth for one page?

    =?Utf-8?B?ZGhucml2ZXJzaWRl?=, Jan 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    614
    Elton Wang
    Jan 8, 2005
  3. Mark Chai
    Replies:
    1
    Views:
    757
    Christophe Vanfleteren
    Oct 1, 2003
  4. Chris Mohan

    Configuring Windows Auth & Forms Auth in Asp.Net

    Chris Mohan, Apr 28, 2004, in forum: ASP .Net Security
    Replies:
    2
    Views:
    479
    Chris Mohan
    Apr 29, 2004
  5. Forms Auth Info passed to Windows Auth?

    , Apr 28, 2005, in forum: ASP .Net Security
    Replies:
    1
    Views:
    269
    Hernan de Lahitte
    May 3, 2005
Loading...

Share This Page