473,327 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

cookie-based authentication with HttpWebRequest

Providing authentication for protected content via Basic/Digest Headers seems
pretty straight-forward, but I'm stuck trying to figure out how to do
something a little different:

say you have some sort of page of customizable content - an example might be
a portal page that you've tweaked to display your favorite headline topics,
your stock portfolio, etc. The page itself isn't protected so you won't be
challenged when you hit that site, but there's a cookie that must be
available to the server so that every time you visit the site (assuming
you've selected the nefarious 'remember me' option), you don't see the
generic page, but your own version instead.

What does that transaction look like, and how/where would your usename and
password be provided so that you can fetch the right version of the page with
a HTTPWebRequest in C#? I have access to the credentials, I just don't know
where to provide them.

Thanks in advance!

- (more) Cowbell
Mar 1 '06 #1
1 1599
Thus wrote cowbell,
Providing authentication for protected content via Basic/Digest
Headers seems pretty straight-forward, but I'm stuck trying to figure
out how to do something a little different:

say you have some sort of page of customizable content - an example
might be a portal page that you've tweaked to display your favorite
headline topics, your stock portfolio, etc. The page itself isn't
protected so you won't be challenged when you hit that site, but
there's a cookie that must be available to the server so that every
time you visit the site (assuming you've selected the nefarious
'remember me' option), you don't see the generic page, but your own
version instead.

What does that transaction look like, and how/where would your usename
and password be provided so that you can fetch the right version of
the page with a HTTPWebRequest in C#? I have access to the
credentials, I just don't know where to provide them.

Thanks in advance!


The best approach to understand how a web applicaton works and how to control
it remotely with HttpWebRequest is to track a browser-based session using
a debugging proxy like Fiddler and then program a sequence of HttpWebRequests
accordingly.

If you have already a persistent cookie on disk, you may even get away with
an unmanaged call to InternetGetCookie(), and add it to your HttpWebRequest's
CookieContainer.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Mar 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Shannon Jacobs | last post by:
I'm doing some trivial surveys, and I want to know if the same user answers twice. Can't really know that, but at least I thought I could check for the same browser/computer combination by using a...
12
by: chrism | last post by:
Hello, I have a pop-up window that I would like to appear in front of the browser home page when a user opens IE. Problem is, I'd like it to never appear again if the user navigates back to the...
5
by: brettr | last post by:
When I reference document.cookie, there is a long string of key=value; pairs listed. I may have 100 hundred cookies on my hard drive. However, most only have one key=value pair. Does the...
4
by: socialism001 | last post by:
I'm trying to store a value in a cookie but its not working. Can anyone see what I might be doing wrong. Thanks, Chris ~~~~~~~~~~~~~~~~~~ <script language="javascript">...
9
by: Marco Krechting | last post by:
Hi All, I have a page with a list of hyperlinks. I want to save information in a cookie about the fact that I entered an hyperlink or not. When I click one of the hyperlinks I want this stored...
3
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code...
1
by: CR1 | last post by:
I found a great cookie script below, but don't know how to make it also pass the values sent to the cookie, to a querystring as well for tracking purposes. Can anyone help? If there was a way to...
6
by: kelvlam | last post by:
Hello all, I'm still a bit new with JavaScript, and I hope the guru here can shed some light for me. It's regarding handling cookie and the case-sensitive nature of JavaScript itself. My...
2
by: kelly.pearson | last post by:
Is this a bug? I am trying to write a cookie that can be accessed by various .Net applications on our domain. However, whenever I add the domain property to the cookie, no errors get thrown but...
5
by: cbhoem | last post by:
Hi - I am trying my hand at python cookies. I'm confused about a few things though. Do the python cookies get written to a cookies text file? I have simple code below -- I see the cookie in...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.