Here is my code. when i run using vs 2005 it works fine. but when i try to run using localhost/app/page.aspx it pops up with error.
Logon failure: unknown user name or bad password.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.DirectoryServices.DirectoryServicesCOMException: Logon failure: unknown user name or bad password.
Source Error:
Line 57:
Line 58: 'Make a serach result
Line 59: Dim sr As SearchResult = searcher.FindOne
Code
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Dim dirObject
As New DirectoryEntry(LDAP://ldap-server.eu.company.net)
Dim searcher
As New DirectorySearcher(dirObject)
searcher.Filter = "sAMAccountName=" +
"yds3k5k3"
searcher.PropertiesToLoad.Add("cn")
Dim sr As SearchResult = searcher.FindOne
Dim strVal
As String = sr.Properties("cn").Item(0).ToString
When I am trying to move the file from one server to another, I am getting the above mentioned error.
System.IO.File.Copy(f1.Path, sToFld )
where f1.Path - source server
sToFld - destination server
I believe its happening since the user credentials are different for both the servers. I was thinking of impersoantion, but I am not sure if impersonation works for remote computer.
Your directory entry needs a userid/password that can search the domain. Most probably it is using the IIS worker process. Get a set of credentials from the network group that you can set. The equvalent c# is
I am facing the same problem in my application.
I am trying to copy files from a server inside a folder in my application. In my development environment it works perfetly while when I publish my app in IIS in Server it generates me the error :
Logon failure: unknown user name or bad password.
I have tried with impersonate in web.config but nothing.
Have anybody of you solved this issue? If yes please tell me how.
Participant
1475 Points
1269 Posts
Logon failure: unknown user name or bad password
May 25, 2007 10:23 AM|jagjot|LINK
HI Folks,
Here is my code. when i run using vs 2005 it works fine. but when i try to run using localhost/app/page.aspx it pops up with error.
Logon failure: unknown user name or bad password.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.DirectoryServices.DirectoryServicesCOMException: Logon failure: unknown user name or bad password.
Source Error:
Code
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Dim dirObject As New DirectoryEntry(LDAP://ldap-server.eu.company.net) Dim searcher As New DirectorySearcher(dirObject) searcher.Filter = "sAMAccountName=" + "yds3k5k3" searcher.PropertiesToLoad.Add("cn") Dim sr As SearchResult = searcher.FindOne Dim strVal As String = sr.Properties("cn").Item(0).ToStringResponse.Write(strVal)
please help.
Jag
M.Sc, MIEEE, MCP, CCNA
Member
1 Points
14 Posts
Re: Logon failure: unknown user name or bad password
Aug 07, 2007 04:48 AM|emcfinest|LINK
I also have the exact error does someone already figure this out.
Participant
1475 Points
1269 Posts
Re: Logon failure: unknown user name or bad password
Aug 08, 2007 10:28 AM|jagjot|LINK
check this out
http://forums.asp.net/t/1100757.aspx
M.Sc, MIEEE, MCP, CCNA
None
0 Points
1 Post
Re: Logon failure: unknown user name or bad password
Jan 20, 2009 08:48 AM|rakesh_cs31|LINK
if u have solution of this problem.
Please give me.
i am gating same problem
: Logon failure: unknown user name or bad password
Member
7 Points
58 Posts
Re: Logon failure: unknown user name or bad password
Jul 28, 2009 01:39 PM|amp0201|LINK
When I am trying to move the file from one server to another, I am getting the above mentioned error.
System.IO.File.Copy(f1.Path, sToFld )
where f1.Path - source server
sToFld - destination server
I believe its happening since the user credentials are different for both the servers. I was thinking of impersoantion, but I am not sure if impersonation works for remote computer.
Thanks for help in advance.
Akhil
Participant
1133 Points
610 Posts
Re: Logon failure: unknown user name or bad password
Jul 28, 2009 02:49 PM|raghu1|LINK
Your directory entry needs a userid/password that can search the domain. Most probably it is using the IIS worker process. Get a set of credentials from the network group that you can set. The equvalent c# is
DirectoryEntry.Username = ; DirectoryEntry.Password=
I don't think you need to load Property unless you are processing that seperately.
Also the syntax: sr.Properties("cn").Item(0).ToString is not correet. There is no Item.
Simple: sr.Properties("cn").Value.ToString() should be.
Member
75 Points
70 Posts
Re: Logon failure: unknown user name or bad password
Sep 16, 2009 04:22 AM|olta|LINK
Hello,
I am facing the same problem in my application.
I am trying to copy files from a server inside a folder in my application. In my development environment it works perfetly while when I publish my app in IIS in Server it generates me the error :
Logon failure: unknown user name or bad password.
I have tried with impersonate in web.config but nothing.
Have anybody of you solved this issue? If yes please tell me how.
Participant
1475 Points
1269 Posts
Re: Logon failure: unknown user name or bad password
Sep 16, 2009 05:32 AM|jagjot|LINK
Try adding worker process in your web project folder on IIS.
Remember you must be under the domain you are trying to access.
or
try passing credentials in your code.(for testing puporses)
Let me know..
M.Sc, MIEEE, MCP, CCNA
None
0 Points
27 Posts
Re: Logon failure: unknown user name or bad password
Nov 13, 2009 02:46 AM|basanthalluri|LINK
jagjot,
Did u find the solution for Logon Failure:Unknown user name or bad password?
Thanks
Basanth