yup yup yup, HashCode is identical. :/
<dbaier@pleasepleasenospam_leastprivilege.com> wrote:
> in the remoting server object
>
> call GetHashCode in Login and GetInfo - just to make sure both calls are
> processed by the same instance.
>
> -----
> Dominick Baier (
http://www.leastprivilege.com)
>
> Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.mic=
rosoft.com/mspress/books/9989.asp)
>
>
>
> > Hello Dominick,
>
> > Okay, I think there's a misunderstanding either on my part or yours,
> > and I think I've narrowed it down to our concept of a request. I
> > envision the following happening :
>
> > User clicks test button on browser
> > http request is sent to client asp.net server
> > client asp.net server passes request to appdomain containing my client
> > app and starts processing TestButton_Click
> > // the following code is common/identical to BOTH my asp.net client
> > AND my winforms client
> > client app creates proxy to MyService
> > client app executes the proxy's Login method (synchronously?), which
> > sends an http request containing (soap?) request/parameters to
> > MyService's asp.net server
> > MyService's asp.net server passes the request to appdomain containing
> > MyService
> > MyService.Login is executed, setting Thread.CurrentPrincipal to
> > "SuperFreak"
> > MyService returns response to client's asp.net server
> > client asp.net server receives request and proceeds to the next line
> > of code in the TestButton_Click
> > // the following shortened for brevity
> > client app executes the proxy's GetInfo method
> > MyService.GetInfo is executed, but Thread.CurrentPrincipal is NOT set
> > to "SuperFreak"
> > MyService returns empty response to client asp.net server (empty
> > because no permissions =3D no result set)
> > client asp.net server receives request and has nothing to display
> > client app executes the rest of TestButton_Click code
> > // end of common code
> > client asp.net server sends response back to user's browser user
> > doesn't see the expected info in browser
>
> > The exact same common code executes perfectly fine when called via a
> > winform client; the Login method is called, Thread.CurrentPrincipal is
> > set to SuperFreak, the GetInfo method is called,
> > Thread.CurrentPrincipal is *still* set to SuperFreak as it should, and
> > returns a result set.
>
> > As you can see, all of this occurs within the user's click of the
> > TestButton, which is in and of itself just one http request. The proxy
> > calls, of course, are multiple requests, but that was always the case
> > even via my winform client.
>
> > I'm trying to find out why this common code works differently when
> > called from an asp.net client vs a winform client; there should be no
> > difference from my limited understanding of the overall process.
>
> > Regards,
>
> > Anthony
>
> > On May 18, 10:36 am, Dominick Baier
> > <dbaier@pleasepleasenospam_leastprivilege.com> wrote:
> >> so the problem is that in asp.net you are creating a new client proxy
> >> to
> >> the remoting object on every request - that means new proxy - new
> >> client
> >> - new thread.currentprincipal - but you want to keep state in the
> >> remoting
> >> server. You have to find a way to reuse the proxy.
> >> maybe you should re-think that des=EDgn - keeping state in a stateless
> >> client is hard to get right.
>
> >> There are several solutions to that:
>
> >> - don't keep state in the remoting object
> >> - login every time before you use the rem obj
> >> - send the authentication information out of band with every call
> >> (using
> >> the call context)
> >> -----
> >> Dominick Baier (
http://www.leastprivilege.com)
> >> Developing More Secure Microsoft ASP.NET 2.0 Applications
> >> (
http://www.microsoft.com/mspress/books/9989.asp)
>
> >>> Hello Dominick!
>
> >>> That's correct, the Thread.CurrentPrincipal is being modified within
> >>> the Login method on the MyService side. Both my winform and asp.net
> >>> clients are calling the Login method and immediately after calls
> >>> other methods. The Thread.CurrentPrincipal remains the same through
> >>> subsequent calls made by my winform client but loses it with my
> >>> asp.net client.
>
> >>> So for a recap :
>
> >>> [client] client calls MyService.Login("SuperFreak", "password")
> >>> [service] MyService's Login method authenticates and changes the
> >>> Thread.CurrentPrincipal (on the MyService side)
> >>> [client] client calls MyService.GetInfo()
> >>> [service] At this point if I trace through MyService.GetInfo()
> >>> (again,
> >>> all on the MyService side), the Thread.CurrentPrincipal will still
> >>> be
> >>> set correctly to SuperFreak if called by my winform client, but set
> >>> to
> >>> my windows account MyDomain\Me when called by my asp.net client.
> >>> What I'm trying to figure out here is why the service-side thread is
> >>> losing it's identity when servicing calls from within a single
> >>> asp.net request.
>
> >>> Regards,
>
> >>> Anthony
>
> >>> On May 18, 2:58 am, Dominick Baier
> >>> <dbaier@pleasepleasenospam_leastprivilege.com> wrote:
> >>>> ah i see - you are talking about T.CP in the remoting server not
> >>>> the asp.net app ?!
>
> >>>> then your remoting server uses a single call pattern....
>
> >>>> Which makes it stateless too...
>
> >>>> I guess you have to switch remoting to CAO (client activated
> >>>> objects).
>
> >>>> -----
> >>>> Dominick Baier (
http://www.leastprivilege.com)
> >>>> Developing More Secure Microsoft ASP.NET 2.0 Applications
> >>>> (
http://www.microsoft.com/mspress/books/9989.asp)-Hide quoted text
> >>>> -
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -