Re: User authentication in Web Service calls from a remote NTD app by Jody
Jody
Tue Oct 28 00:52:36 CST 2003
Basically the steps that you will need to take are as follows
1. Add in a web reference in your windows app (obviously referencing your
xml web service)
2. You should only need to assign a network credential when you are
instanciating the web service object so if that is in your Form Load event
then that is where you would want to put the below code.
3. You should then be able to utilise the Web Service in any other parts of
the application provided you use the original instance of the web service
eg
In the top of the form put
dim ws as com.mydomain.www.webservice()
const myUID = "yourusername"
const myPWD = "yourpassword"
Sub Form_Load(....) handles ......
ws = new com.mydomain.www.webservice()
ws.Credentials = new System.Net.NetworkCredentials(myUID,myPWD)
end sub
' then you can call the webservice in other parts of your code
Sub Button1_click(...) handles.....
ws.yourprocedure()
End Sub
Does that make a bit more sense
let me know if you would like any further help....
<anonymous@discussions.microsoft.com> wrote in message
news:05e001c39c78$2cd23c90$a501280a@phx.gbl...
> Jody
>
> Thank you for your reply but I am not totally how you
> mean this to be used. The only 'webservice' class I found
> was in System.Web.WebServices namespace. You must forgive
> me but I have only just begun developing in .NET / C# so
> your answer, while it may be obvious to some, is
> confusing me somewhat. Would you mind elaboraing and
> explaining just how you mean it to be used. Thank you for
> your time.
>
> Michael
>
> >-----Original Message-----
> >com.mydomain.www.webservice ws = new
> com.mydomain.www.webservice();
> >ws.Credentials = new
> >System.Net.NetworkCredential
> (this.txtUsername.Text.ToString(),this.txtPasswo
> >rd.Text.ToString());
> >
> >Cheers
> >
> >--
> >Jody
> >[MCSD.Net]
> >
> >"Mike Friel" <mfriel@starmark.biz> wrote in message
> >news:090601c39a10$b2c4ebf0$a301280a@phx.gbl...
> >> I am developing a Windows Forms application that makes
> >> requests to a web service and in return receives
> >> configuration data that is user specific, i.e. based on
> >> the user's window's authenication on the server side
> >> domain. My problem is that I am unaware as to how I
> >> should configure the app so that when it calls into the
> >> web service, the web server will be able to identify
> the
> >> user. Initially the application will be running on the
> >> same domain either over a LAN or though a VPN
> connection
> >> although it is anticipated that in the future
> connections
> >> may be made from a m/c outside this remit although the
> >> latter scenario does not have a high priority right
> now.
> >> Any illumination on this topic will be gratefully
> >> received. Thank you.
> >>
> >
> >
> >.
> >