473,320 Members | 1,950 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,320 software developers and data experts.

InternetSetCookie() replacement?

RWF
I am in the midst of converting a .NET 1.1 app to 2.0, and have run across a
section where the old programmers were using [DllImport("wininet.dll")] to
get to InternetSetCookie().

Is there a way to do this natively in .NET 2.0?
Jun 27 '06 #1
2 7549
Hello, RWF!

R> I am in the midst of converting a .NET 1.1 app to 2.0, and have run
R> across a section where the old programmers were using
R> [DllImport("wininet.dll")] to get to InternetSetCookie().

R> Is there a way to do this natively in .NET 2.0?

Look at HttpWebRequest.CookieContainer

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Jun 27 '06 #2
This isn't necessarily the same as using the CookieContainer.

If you are trying to set cookies that are used for the duration of a
request, then yes, this is the same.

However, InternetSetCookie was also used to write persistent cookies to
disk for IE/WinInet's use. Cookies that come back from
HttpWebRequest/HttpWebResponse will not be persisted to disk if an
expiration date is set.

If you have the desire to write cookies to this store, then you have to
call this method through the P/Invoke layer.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Vadym Stetsyak" <va*****@ukr.net> wrote in message
news:Oz**************@TK2MSFTNGP05.phx.gbl...
Hello, RWF!

R> I am in the midst of converting a .NET 1.1 app to 2.0, and have run
R> across a section where the old programmers were using
R> [DllImport("wininet.dll")] to get to InternetSetCookie().

R> Is there a way to do this natively in .NET 2.0?

Look at HttpWebRequest.CookieContainer

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com

Jun 27 '06 #3

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

Similar topics

5
by: Paul Miller | last post by:
We've run into minidom's inabilty to handle large (20+MB) XML files, and need a replacement that can handle it. Unfortunately, we're pretty dependent on a DOM, so a pulldom or SAX replacement is...
53
by: Kerberos | last post by:
I followed Dan Cederholm's image replacement tutorial, to replace a header tag by a logo. The h1 is clickable if no CSS is applied but it I replace it by the logo, the area isn't clickable anymore...
3
by: Vibha Tripathi | last post by:
Hi Folks, I put a Regular Expression question on this list a couple days ago. I would like to rephrase my question as below: In the Python re.sub(regex, replacement, subject)...
2
by: brian | last post by:
Hi, before coming to .NET, I utilized regular expressions mostly in JScript / JavaScript and also in my favorite text editor: TextPad (www.textpad.com) I don't know about JScript/JavaScript, but...
20
by: Paul D. Boyle | last post by:
Hi all, There was a recent thread in this group which talked about the shortcomings of fgets(). I decided to try my hand at writing a replacement for fgets() using fgetc() and realloc() to read...
3
by: Jeffrey D. Gordon | last post by:
I'm wanting to replace Field Values in an existing PDF, I've done this with PHP by doing a replace in the file. I've been able to read the file in a byte array in c# but all my attempts to...
3
by: chris | last post by:
Hallo, I am in need of a replacement for the Microsoft Visual Studio .NET. The reason is quiet simple. I develop forms which are used on different microsoft windows platform, and one...
1
by: lawrence k | last post by:
Want to replace the limit clause in a query, but can't get it right. What's wrong with this: $pattern = "(.*)limit (.*)"; $replacement = '$1'; $replacement .= "LIMIT $limit"; $replacement .=...
3
by: =?Utf-8?B?RHVrZSAoQU4yNDcp?= | last post by:
I've added a web deployment project and want to use the config section replacement but I'm obviously not understanding something. I have set up an alternate appSettings file,...
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...
1
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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...
0
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.