views:

44

answers:

1

Hi,

I need to be able to login to a site via Forms Authentication using a HttpWebRequest.

Currently, when I provide NetworkCreditials to the request, it just redirects me to the Login page, which makes sense...but how do I go about ensuring that the request correctly authenticates without redirecting?

Thanks,
Kieron

A: 

If the site uses cookies to tracks users you need to use a cookie container in order to store the authentication cookie emitted by the server and reuse this cookie in later requests to access authenticated parts of the site.

Darin Dimitrov
Also you cant just use NetworkCredential. That is for transport authentication. You will have to figure out how the credentials are being passed to the page -usually through FORMS post.
feroze
Thanks @feroze, i think I'm going to have to go via the redirect,detect and post route.
Kieron