User authentication in Web Service calls from a remote NTD app

  • Thread starter Thread starter Mike Friel
  • Start date Start date
M

Mike Friel

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.
 
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 said:
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.


.
 
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....
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 said:
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.


.
 
Back
Top