RE: How to add cookie with axWebBrowser
- From: Peter Zhou <bokesoft@xxxxxxxxxxxxxxxx>
- Date: Tue, 28 Aug 2007 01:00:03 -0700
Hi Walter:
Thank you very much, It's really the solution we need, we spent almost two
weeks on this problem, for we need a cookie item to implement loading balance
on server.
""Walter Wang [MSFT]"" wrote:
Hi Peter,.
Welcome to MSDN Managed Newsgroup!
Due to WinInet design, WebBrowser's Navigate or Navigate2 cannot set the
cookies in the extra headers. You will need to use WinInet API
InternetSetCookie to workaround this:
Private Declare Function InternetSetCookie Lib "wininet.dll" _
Alias "InternetSetCookieA" _
(ByVal lpszUrlName As String, _
ByVal lpszCookieName As String, _
ByVal lpszCookieData As String) As Boolean
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
InternetSetCookie("http://server/asp/", "test", "foo")
AxWebBrowser1.Navigate2("http://server/asp/test.asp")
End Sub
In the asp/test.asp:
<% Response.Write(Request.Cookies("test")) %>
This should correctly display "foo" in the webpage.
Hope this helps.
Sincerely,
Walter Wang (wawang@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support
==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
- References:
- RE: How to add cookie with axWebBrowser
- From: "Walter Wang [MSFT]"
- RE: How to add cookie with axWebBrowser
- Prev by Date: RE: How to add cookie with axWebBrowser
- Previous by thread: RE: How to add cookie with axWebBrowser
- Index(es):
Relevant Pages
|