|
-
April 22nd, 2008, 09:17 AM
#1
connecting to user/password protected server
Hi, i have written an app that needs to connect to a server that has access rights associated with it. If i am logged on as a certain person who has access privaleges there is not a problem. In certain circumstances the computer running my app has not network connection to a domain. I have programmed access to the domain but the server i need to access data on in the domain is user and password protected. If i use the following code i cannot access the file.
using (StreamReader sr = new StreamReader("\\\\Ukptserver03\\Archive\\Users.Dat"))
{
String line;
while ((line = sr.ReadLine()) != null)
{
.....etc
Are there any other parameters i need to pass to the streamreader or do i need to set something else up.
Thanks.
-
April 22nd, 2008, 10:14 AM
#2
Re: connecting to user/password protected server
Here's an article showing you how to impersonate a specific user in code.
http://support.microsoft.com/?id=306158#4
If you throw an exception, whatever code catches it will also run in that security context, so watch out for that.
-
April 23rd, 2008, 01:05 AM
#3
Re: connecting to user/password protected server
 Originally Posted by MikeVallotton
Here's an article showing you how to impersonate a specific user in code.
http://support.microsoft.com/?id=306158#4
If you throw an exception, whatever code catches it will also run in that security context, so watch out for that.
Thanks for this, it is very helpful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|