?
Solved

Reading the ASP.NET_SessionID Cookie value from an ASP>Net web service

Posted on 2006-10-20
4
Medium Priority
?
1,043 Views
Last Modified: 2010-08-05
I have used the following article to maintain sessions in a web service :

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnservice/html/service08062002.asp

using the following code I would like to read the value (SessionID) that is set in the cookie returned in the web service result.

Private Cookies As System.Net.CookieContainer

Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    Dim proxy As New localhost.Service1()
    Dim ret As Integer
    ' Set the Cookie Container on the proxy
    If Cookies Is Nothing Then
        Cookies = New System.Net.CookieContainer()
    End If
    proxy.CookieContainer = Cookies
    ret = proxy.IncrementSessionCounter()
    Label1.Text = "Result: " & CStr(ret)
End Sub


after the web service comes back I can see that Cookies.Count gets set to 1 but I can't find a way to read the cookie value.

please help
0
Comment
Question by:webprouk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Expert Comment

by:hclgroup
ID: 17773927
0
 
LVL 7

Accepted Solution

by:
nepali earned 2000 total points
ID: 17774707
Try this ..
If the your webservice url is
http://127.0.0.1/TestSessionState/zzz.asmx

   Dim z1 As New localhost.zzz()
        ' Set the Cookie Container on the proxy
        If Cookies Is Nothing Then
            Cookies = New System.Net.CookieContainer
        End If
        z1.CookieContainer = Cookies
        Dim uri1 As New Uri("http://127.0.0.1/TestSessionState/zzz.asmx")
        For Each zzzcookie As System.Net.Cookie In z1.CookieContainer.GetCookies(uri1)
            Debug.WriteLine(zzzcookie.Value)
        Next
0
 
LVL 1

Author Comment

by:webprouk
ID: 17774846
this gets the cookie info of the web page - not the cookie info sent from the web service.
0
 
LVL 1

Author Comment

by:webprouk
ID: 17775303
thanks a lot nepali, that did the trick
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question