Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. VS2008 SOAP Client - losing Session problem

VS2008 SOAP Client - losing Session problem

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netvisual-studiowcftools
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anbam
    wrote on last edited by
    #1

    i made a Web Service project in visual studio 2008. then added 2 "Web Service" files to the project. Service1.asmx Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ' <system.web.script.services.scriptservice()> _ <system.web.services.webservice(namespace:="http://tempuri.org/")> _ <system.web.services.webservicebinding(conformsto:=WsiProfiles.BasicProfile1_1)> _ <toolboxitem(false)> _ Public Class Service1 Inherits System.Web.Services.WebService <webmethod(true)> _ Public Function HelloWorld() As String Session("foo") = "bar" Return "Hello World" End Function End Class Service2.asmx Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ' <system.web.script.services.scriptservice()> _ <system.web.services.webservice(namespace:="http://tempuri.org/")> _ <system.web.services.webservicebinding(conformsto:=WsiProfiles.BasicProfile1_1)> _ <toolboxitem(false)> _ Public Class Service2 Inherits System.Web.Services.WebService <webmethod(true)> _ Public Function HelloWorld() As String If Session("foo") <> "bar" Then Throw New UnauthorizedAccessException End If Return "Hello World" End Function End Class After i made a windows application, where i made a "Service Reference" to both web service classes/files. The problem is that Service1.asmx doesn't share it's session with Service2.asmx,... I get the thrown "UnauthorizedAccessException" on calling "Service2.HelloWorld()" because the session is not created in Service2.asmx after calling Service2... Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim bhp As New System.ServiceModel.BasicHttpBinding bhp.AllowCookies = True Dim x As New ServiceReference1.Service1SoapClient(bhp, New ServiceModel.EndpointAddress("http://localhost/ImsBrowserWebService/Service1.asmx")) Dim y As New ServiceReference2.Service2SoapClient(bhp, New ServiceModel.EndpointAddress("http://localhost/ImsBrowserWebService/Service2.asmx")) MsgBox(x.HelloWorld) MsgBox(y.HelloWorld)

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups