I works! Thanks.
"Paul R" wrote:
> Hi Joubert. Thanks for your help.
>
> I cannot try this until tonight. But, from what I read in your link, it
> looks like I need to create a CookieContainer object for my Client
> application, and assign it as the CookieContainer property on each proxy into
> my web service. This, according to the link, is because a Win32
> application does not support cookies by default.
>
> I had suspected that it had something to do with the AuthCookie, but didn't
> know how the client was supposed to get to it. Apparently, the
> CookieContainer takes care of that for the client. Very Nice. Looks
> pretty simple. I'm kind of embarrassed ;-)
>
> Thanks again.
>
> - Paul
>
> "Joubert Nel" wrote:
>
> > Hello Paul,
> >
> > Have a look at
> >
http://www.dotnet247.com/247reference/a.aspx?u=http://
www.dotnetjunkies.com/Tutorial/5D8B6D51-97B7-4825-B919-49A721A3FDF6.dcik > >
> > There is a section about using Forms authentication and IIS-based web
> > services from a WinForms app. May help you with the issue below.
> >
> > Regards
> > Joubert
> >
> >
> > "Paul R" <Paul R@discussions.microsoft.com> wrote in message
> > news:6B4CA07A-F203-4010-8C3A-DE5EDF74A50C@microsoft.com...
> > > Hi.
> > >
> > > I have a question about how to call a WebService from a a Windows Forms
> > > application.
> > >
> > > I have developed a WebService that has a Login method. Stripped down,
> > > it
> > > looks like this..
> > >
> > > public bool Login(string userName, string password )
> > > {
> > > bool bLoggedIn = false;
> > > if( userName.Length > 0 && password.Length > 0 )
> > > {
> > > // bLoggedIn = do login here
> > > if( bLoggedIn )
> > > {
> > > FormsAuthentication.SetAuthCookie( userName, false );
> > > }
> > > }
> > > return bLoggedIn;
> > > }
> > >
> > >
> > > Each subsequent call will verify, who the user is, before continuing...
> > >
> > > string VerifyUserName(HttpApplication app)
> > > {
> > > string userName = app.Context.User.Identity.Name;
> > > return userName;
> > > }
> > >
> > >
> > > While debugging the WebService, I tried to call the methods through
> > > Internet
> > > Explorer (and FireFox). First I call the Login web method and then the
> > > subsequent call. I have a breakpoint in the second call and can see
> > > that
> > > the User.Identity.Name value is the same that I passed into the
> > > SetAuthCookie
> > > call. So, I think I have coded the server correctly.
> > >
> > > Now, when I try to call this from my Windows Forms application I get a
> > > different result. The call to Login appears to behave identically.
> > > The
> > > call to VerifyUserName fails because User.Identity is null. So, my
> > > guess
> > > is I need to do something in my windows forms application to let each
> > > subsequent call know who is making the call.
> > >
> > > In my client code, I just create a new proxy to my webservice and call a
> > > method. Is there some sort of Connection Context object that I need to
> > > pass into each web service call? If so, how do you create it and how do
> > > you
> > > pass it to a webservice.
> > >
> > > Thanks in advance for your help.
> > >
> >
> >