How to access a password protected UNC address?
-
Hello, I am accessing a shared file through UNC address over LAN. Whenever I do that, the windows login prompt appears. I need to bypass this prompt though C# code. How can I do it? Regards, Zishan
-
Hello, I am accessing a shared file through UNC address over LAN. Whenever I do that, the windows login prompt appears. I need to bypass this prompt though C# code. How can I do it? Regards, Zishan
\\server-name\directory\filename Just try with this, if possible u can get it. please help me
-
\\server-name\directory\filename Just try with this, if possible u can get it. please help me
Thanks for the reply.. yes right but then I try to access file like this.. a windows login prompt appears and I have to enter username and password manually.. I want this manual thingi to be handled by code. Some way to enter this Windows Authentication. Regards Zishan
-
Thanks for the reply.. yes right but then I try to access file like this.. a windows login prompt appears and I have to enter username and password manually.. I want this manual thingi to be handled by code. Some way to enter this Windows Authentication. Regards Zishan
Have you tried using System.Diagnostics.ProcessStartInfo? With that, you can supply a user name & password through code, but I don't know if this will work for UNC shares.
-
Hello, I am accessing a shared file through UNC address over LAN. Whenever I do that, the windows login prompt appears. I need to bypass this prompt though C# code. How can I do it? Regards, Zishan
You can try Judah's suggestion. I don't know if it'll work either. But, if it doesn't, a workaround I know of would be to temporarily map a drive to the share. You can most definately supply the username and password to that. But, to clarify, there is NO WAY to get around that login box. The machine your connecting to wants to know who is trying to get into that share. That target machine doesn't trust the credentials that your app is running under. There is simply no way of getting around that. But, if the credentials are supplied using a different method, that box won't show up. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
You can try Judah's suggestion. I don't know if it'll work either. But, if it doesn't, a workaround I know of would be to temporarily map a drive to the share. You can most definately supply the username and password to that. But, to clarify, there is NO WAY to get around that login box. The machine your connecting to wants to know who is trying to get into that share. That target machine doesn't trust the credentials that your app is running under. There is simply no way of getting around that. But, if the credentials are supplied using a different method, that box won't show up. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Thanks both of you.. I am off from work now.. will try Judah's suggestion tomorrow. Dave what credentials are you talking about.. can you please elaborate a bit more.. Let me be more precise. I have an application running on Windows XP Professional trying to access a shared file located on a network drive which is running Windows Server 2000. What's that "other method" :confused: Can you elaborate? Thanks Zishan
-
Thanks both of you.. I am off from work now.. will try Judah's suggestion tomorrow. Dave what credentials are you talking about.. can you please elaborate a bit more.. Let me be more precise. I have an application running on Windows XP Professional trying to access a shared file located on a network drive which is running Windows Server 2000. What's that "other method" :confused: Can you elaborate? Thanks Zishan
Zishan Haider wrote:
what credentials are you talking about
The credentials you used when you logged into Windows on your machine...Username and password. When you try to connect to another Windows machine, those credentials are sent to the remote machine. If that machine isn't a member of the same domain (if you have one!) as your machine, then it has to rely on its own user accounts to authenticate you. If your username doesn't exist on the remote machine, it'll ask you for an account and password that it knows about, because it doesn't trust the account information it's getting from your machine. Now, you only have to log into a remote machine once and it'll remember who you are for as long as you are logged into your machine. There are many different ways to get an authenticated connection to a remote Windows machine. The most common is mapping a drive letter to a share on the remote machine. You have to supply a username and password to the remote machine if it doesn't trust you. Since you can't just connect to a remote share without first authenticating to the remote machine, you need to authenticate an account with the remote machine. You can't do that by just connecting to a remote share. There's no way to enter the account information. But, you CAN do it through code if your code maps a drive to the share first. You have to supply the function For example...[^] RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Zishan Haider wrote:
what credentials are you talking about
The credentials you used when you logged into Windows on your machine...Username and password. When you try to connect to another Windows machine, those credentials are sent to the remote machine. If that machine isn't a member of the same domain (if you have one!) as your machine, then it has to rely on its own user accounts to authenticate you. If your username doesn't exist on the remote machine, it'll ask you for an account and password that it knows about, because it doesn't trust the account information it's getting from your machine. Now, you only have to log into a remote machine once and it'll remember who you are for as long as you are logged into your machine. There are many different ways to get an authenticated connection to a remote Windows machine. The most common is mapping a drive letter to a share on the remote machine. You have to supply a username and password to the remote machine if it doesn't trust you. Since you can't just connect to a remote share without first authenticating to the remote machine, you need to authenticate an account with the remote machine. You can't do that by just connecting to a remote share. There's no way to enter the account information. But, you CAN do it through code if your code maps a drive to the share first. You have to supply the function For example...[^] RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Hey Dave.. Thanks a lot for your support.. it just solves my problem :-D