HTTPWebRequest + Cookies problem

O

Ori

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

Vitaly Filimonov [MSFT]

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top