Home > Uncategorized > Changing a Cookie’s path C#

Changing a Cookie’s path C#

When using a httpWebRequest to a page, with an attached Cookie container, you may find sometimes that the Cookie is set with the wrong path, for instance /cgi-bin/process.cgi rather than cgi-bin/ – This may make the cookie unreadable to other pages within that folder.

Fear not, the solution is simple

Dim cA As Cookie
Dim ccS As CookieCollection
ccS = RequestCookies.GetCookies(
New Uri(http://www.someuri.com/cgi-bin/process.cgi"))
cA = ccS.Item(0)
cA.Path = "/cgi-bin"

RequestCookies being a Cookie Container object.


Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s