0
I built an application using Asp.net where in a few moments of the application I need to access a directory and scan files and sometimes move and delete them. On my micro worked perfectly, but when climbing the application on the IIS server it started to return the error System.IO.Ioexception: The user name or password is incorrect.. I accessed the server and logged in the directory I need to access, besides that I gave permission to the IUSR user (by the way for all), to access, but I keep receiving the error message. Is there any way to log into the application in the directory passing user and password or be able to access the directory in some other way?
Note: The micro I am trying to access is not in the same domain as my server and unfortunately I cannot put them in the same domain.
Let me get this straight, you have an application on the x server that tries to access a directory on the y server. That’s it?
– Gabriel Coletta
Yes. One server sees the other, only inside the application is not working.
– Rayan Pereira de Lima
Dude, how are connecting or other micro? ftp? Show me the code!
– DiegoSantos
Apparently, you are trying to access a folder from a server that requires logon. When starting the service on IIS, it attempts to access with the IUSR credential, which will not be validated on the other server. I found something that seems to solve: I don’t know if it will work for Asp.net https://stackoverflow.com/questions/5023607/how-to-use-logonuser-properly-to-impersonate-domain-user-from-workgroup-client
– Rovann Linhalis
Locally I didn’t need to log in using the application. I logged in windows itself. In my application I am basically running
Directory.GetFiles();
and works normally. Already on the server does not roll. At first I thought it might be something in windows. But what I did locally did not roll on the server.– Rayan Pereira de Lima
@Rovannlinhalis I will try to implement this code and put the result.
– Rayan Pereira de Lima
you can also use a mapped network drive. Have you tried ? can be easier
– Rovann Linhalis
I tried using the mapped drive, again locally worked perfectly. Already on the server did not roll. Just call me back and tell me that the path has not been found.
– Rayan Pereira de Lima
uses command prompt as administrator to map the unit
– Rovann Linhalis
Enter the code of how you are doing to access this directory
– Leandro Angelo
At first I managed to do it with a "gambiarra". I created a user on my application server and another on the target server with the same username and password. So the system was able to access and manipulate the files.
– Rayan Pereira de Lima