HTTPWebRequest + Cookies problem

Discussion in 'ASP .Net Web Services' started by Ori, Feb 18, 2004.

  1. Ori

    Ori Guest

    Hi,

    In continue to another post which I have in this news group, I was
    able to find out some more details about the problem

    What is my problem?

    I currently build some kind of web-service which illustrates the
    web-site login, some query and retrieve some data from this websites.

    I have a website which I'm not able to login into (although I pass all
    the variables which need to be sent) and I'm getting the same error:
    "Your session has expired. Please login again.".

    The wired part that if I'm taking the URL which I generate, and place
    it in the IE browser, I'm login successfully, but when I'm using is
    through the HTTWebRequest (doesn't matter if I'm using GET/POST) I'm
    not able to login.

    What I've found so far?

    From what I was able to figure out, it's something which related to
    cookies. If I'm disabling the cookies on my IE I see that I'm not able
    to login to the website (get the same error message).
    Nevertheless, when I enables the cookies (and also succeed to login to
    the website) I wasn't able to see any cookie in my cookies folder
    which belongs to this website.

    Is there any setting which I need to set in my HTTWebRequest object in
    order to enable cookies or something like that? Does anyone has any
    idea how to solve my problem ?

    Thanks,

    Ori.
     
    Ori, Feb 18, 2004
    #1
    1. Advertising

  2. Hello,

    It appears that you are using cookie-based authentication. If so, your
    login web request should return you a cookie which has login ticket or
    something like that. You can extract that cookie using
    HttpWebResponse.Cookies collection. You'll need to add that cookie with its
    content using HttpWebRequest.CookieContainer for all subsequent requests.
    Tihs way your web request will contain required cookie(s) and web server
    auth module will be able to test that you're logged in.

    I can work on a little example of that if you can't get your process to
    work...

    --
    Vitaly.
    -------
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of included script samples are subject to the terms specified at
    http://www.microsoft.com/info/cpyright.htm.

    "Ori" <> wrote in message
    news:...
    > Hi,
    >
    > In continue to another post which I have in this news group, I was
    > able to find out some more details about the problem
    >
    > What is my problem?
    >
    > I currently build some kind of web-service which illustrates the
    > web-site login, some query and retrieve some data from this websites.
    >
    > I have a website which I'm not able to login into (although I pass all
    > the variables which need to be sent) and I'm getting the same error:
    > "Your session has expired. Please login again.".
    >
    > The wired part that if I'm taking the URL which I generate, and place
    > it in the IE browser, I'm login successfully, but when I'm using is
    > through the HTTWebRequest (doesn't matter if I'm using GET/POST) I'm
    > not able to login.
    >
    > What I've found so far?
    >
    > From what I was able to figure out, it's something which related to
    > cookies. If I'm disabling the cookies on my IE I see that I'm not able
    > to login to the website (get the same error message).
    > Nevertheless, when I enables the cookies (and also succeed to login to
    > the website) I wasn't able to see any cookie in my cookies folder
    > which belongs to this website.
    >
    > Is there any setting which I need to set in my HTTWebRequest object in
    > order to enable cookies or something like that? Does anyone has any
    > idea how to solve my problem ?
    >
    > Thanks,
    >
    > Ori.
     
    Vitaly Filimonov [MSFT], Feb 21, 2004
    #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. Ulrich Sprick
    Replies:
    3
    Views:
    506
    Ulrich Sprick
    Oct 7, 2004
  2. Luis Esteban Valencia Muñoz

    Using HttpWebRequest to post form data with cookies

    Luis Esteban Valencia Muñoz, Jun 13, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    6,074
    Buddy Ackerman
    Jun 13, 2005
  3. Andy Fish
    Replies:
    3
    Views:
    1,209
    Andy Fish
    Aug 23, 2005
  4. =?Utf-8?B?am9obiBjb253ZWxs?=

    HttpWebRequest with session cookies

    =?Utf-8?B?am9obiBjb253ZWxs?=, Feb 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    12,289
    Scott Allen
    Feb 9, 2006
  5. _Who
    Replies:
    7
    Views:
    2,686
Loading...

Share This Page