473,796 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Impersonating doesn't work on Win2003

fab
Hello,

i'm trying to browse a UNC share through an ASP.NET application and i've got
a problem :
i've tried some examples from MSDN or other web sites (using LogonUser from
Win32 API) and it works perfectly from my computer (windows XP) but it
doesn't work from a windows2003 server : i've got the famous error 1326 :
Logon failure: unknown user name or bad password. ERROR_LOGON_FAI LUREis
there a special configuration for Win2003 ? i've tried to set ASPNET user
account "as part of the operating sysem" in local security policy but it
makes nothing...

thanks in advance.


May 15 '06 #1
5 2077
On Windows user account is "Network Service" and not ASPNET.
"fab" <aa*@aaaa.com > wrote in message
news:e4******** **@s1.news.olea ne.net...
Hello,

i'm trying to browse a UNC share through an ASP.NET application and i've
got a problem :
i've tried some examples from MSDN or other web sites (using LogonUser
from Win32 API) and it works perfectly from my computer (windows XP) but
it doesn't work from a windows2003 server : i've got the famous error 1326
:
Logon failure: unknown user name or bad password. ERROR_LOGON_FAI LUREis
there a special configuration for Win2003 ? i've tried to set ASPNET user
account "as part of the operating sysem" in local security policy but it
makes nothing...

thanks in advance.

May 15 '06 #2
fab
i've also tried "Network Service" for the same result

"Winista" <na*********@ho tmail.com> a écrit dans le message de news:
e7************* *@TK2MSFTNGP05. phx.gbl...
On Windows user account is "Network Service" and not ASPNET.
"fab" <aa*@aaaa.com > wrote in message
news:e4******** **@s1.news.olea ne.net...
Hello,

i'm trying to browse a UNC share through an ASP.NET application and i've
got a problem :
i've tried some examples from MSDN or other web sites (using LogonUser
from Win32 API) and it works perfectly from my computer (windows XP) but
it doesn't work from a windows2003 server : i've got the famous error
1326 :
Logon failure: unknown user name or bad password. ERROR_LOGON_FAI LUREis
there a special configuration for Win2003 ? i've tried to set ASPNET
user account "as part of the operating sysem" in local security policy
but it makes nothing...

thanks in advance.


May 15 '06 #3
For UNC path...

1. Make sure that you are impersonating as domain account who has rights on
the shares.
2. Make sure that web.config is modified to use impersonation.

Is file server same as web server?
Does your file server allow ASPNET/Network Service account to access the
share?

"fab" <aa*@aaaa.com > wrote in message
news:e4******** **@s1.news.olea ne.net...
i've also tried "Network Service" for the same result

"Winista" <na*********@ho tmail.com> a écrit dans le message de news:
e7************* *@TK2MSFTNGP05. phx.gbl...
On Windows user account is "Network Service" and not ASPNET.
"fab" <aa*@aaaa.com > wrote in message
news:e4******** **@s1.news.olea ne.net...
Hello,

i'm trying to browse a UNC share through an ASP.NET application and i've
got a problem :
i've tried some examples from MSDN or other web sites (using LogonUser
from Win32 API) and it works perfectly from my computer (windows XP) but
it doesn't work from a windows2003 server : i've got the famous error
1326 :
Logon failure: unknown user name or bad password. ERROR_LOGON_FAI LUREis
there a special configuration for Win2003 ? i've tried to set ASPNET
user account "as part of the operating sysem" in local security policy
but it makes nothing...

thanks in advance.



May 15 '06 #4
fab
the domain account has rights on the share because when i try to browse the
share from windows explorer, it works.
I've put <identity impersonate="tr ue" /> " in the web.config (if i set this
parameter to false, it works on my winxp config)

The file server is not the same as the web server.
How can i give the network service account of the web server (witch is a
local account on the web server i think) access to the file server ? I
thought i've to give access to the file sever's share only the account that
i impersonate ?

"Winista" <na*********@ho tmail.com> a écrit dans le message de news:
ur************* *@TK2MSFTNGP05. phx.gbl...
For UNC path...

1. Make sure that you are impersonating as domain account who has rights
on the shares.
2. Make sure that web.config is modified to use impersonation.

Is file server same as web server?
Does your file server allow ASPNET/Network Service account to access the
share?

"fab" <aa*@aaaa.com > wrote in message
news:e4******** **@s1.news.olea ne.net...
i've also tried "Network Service" for the same result

"Winista" <na*********@ho tmail.com> a écrit dans le message de news:
e7************* *@TK2MSFTNGP05. phx.gbl...
On Windows user account is "Network Service" and not ASPNET.
"fab" <aa*@aaaa.com > wrote in message
news:e4******** **@s1.news.olea ne.net...
Hello,

i'm trying to browse a UNC share through an ASP.NET application and
i've got a problem :
i've tried some examples from MSDN or other web sites (using LogonUser
from Win32 API) and it works perfectly from my computer (windows XP)
but it doesn't work from a windows2003 server : i've got the famous
error 1326 :
Logon failure: unknown user name or bad password. ERROR_LOGON_FAI LUREis
there a special configuration for Win2003 ? i've tried to set ASPNET
user account "as part of the operating sysem" in local security policy
but it makes nothing...

thanks in advance.




May 16 '06 #5
For what it's worth, I just solved this problem within my own ASP.NET
application. Here's the code snippet I used to do it. The fix for me
was changing the LogonType to LOGON32_LOGON_I NTERACTIVE (2) instead of
LOGON32_LOGON_N ETWORK (3). Here's the code snippet that gets access to
my users...

bool bValidUser =
LogonUser("UNAM E","DOMAIN","PA SSWORD",(int)LO GON32_LOGON_INT ERACTIVE,(int)L OGON32_PROVIDER _DEFAULT,ref
token);
System.Security .Principal.Wind owsIdentity myWI2 = new
System.Security .Principal.Wind owsIdentity(tok en);
System.Security .Principal.Wind owsImpersonatio nContext myWIC2 =
myWI2.Impersona te();

string sDir = "\\\\UNCPAT H";
string[] arFiles = System.IO.Direc tory.GetFiles(s Dir);

Before switching the LogonType, my try block would catch the the
'access to UNCPATH is denied' error. I don't use web.config
impersonation, but I do use integrated windows authentication (just so
I'm sure only people on the domain are accessing the intranet app I'm
building). With this method, I don't think either web.config
impersonation or integrated win auth have any bearing on the results.

From
http://msdn.microsoft.com/library/de.../logonuser.asp
LOGON32_LOGON_I NTERACTIVE This logon type is intended for users who
will be interactively using the computer, such as a user being logged
on by a terminal server, remote shell, or similar process. This logon
type has the additional expense of caching logon information for
disconnected operations; therefore, it is inappropriate for some
client/server applications, such as a mail server.
LOGON32_LOGON_N ETWORK This logon type is intended for high performance
servers to authenticate plaintext passwords. The LogonUser function
does not cache credentials for this logon type.

I figured that maybe LOGON_NETWORK wasn't keeping the appropriate user
cached for my attempt to access the UNCPATH. I hope this helps you
out, yesterday was a pretty infuriating day trying to puzzle this out.

May 19 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
7347
by: Niels Sloth | last post by:
Hi I have 9 asp-sites on a Win2003 server, and would like to use the same include file, but it does not work. The path for the servers default website (which is not where the problem is) is c:\inetpub\wwwroot\ and the rest of the sites are at c:\inetpub\wwwroot\websites\Site1\ , ..\Site2\ etc. I tried using the following on the secondary sites:
5
1545
by: michaaal | last post by:
I am trying to run this code on a Windows 2003 Server. I have ASP enabled. Any idea why it doesn't work? <% newDB = "new.mdb" newDB = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & newDB Set cat = CreateObject("ADOX.Catalog") cat.Create newDB
0
1393
by: Randy | last post by:
Hi all, I'm a developer on the database backend and need to figure out how to get a c++ .net executable to run on a win2003 server. The executable transfers data between oracla and sql server for datawarehousing. I dont know much ..net. It works fine on win2000 and my group has set up another win2000 server and migrated to that one OK. On the win2003 the error in the log file is this : ERROR: Run_Spec_ADO_Curs::get_curr: caught...
3
2757
by: Daniel | last post by:
Is it possible to retain local file system read, write, delete access while impersonating for access to a remote drive in a different domain? I need to be able to move files from a local computer to a remote computer. do i have to copy them from the local computer to the remote computer then delete them fromt the local computer after undo-ing the impersonation? Or is there a way to retain access to both the local computer and the remote...
3
1082
by: George Ter-Saakov | last post by:
I have an application i wrote on Win2k and everything is working. When i moved it to the Host one button stopped working. I am lost. I do not know what can be wrong. Here is the url http://robertkree.com/ShippingAddress.aspx The button "Continue Checkout" does not work. It does not do anything. On development environment it shows and error ( you must provide FirstName,
4
1343
by: Adrian Parker | last post by:
I have a web app that has one problem when deployed on win2003 but works fine on win2k. On a page, I have a button that causes a reload of the page with a different set of querystring values (to move to next week) the codebehind the button just says Response.Redirect("mypagename.aspx?year=2005&month=11&day=21")
2
1505
by: Don Rich | last post by:
Please share with me any ideas you may have for troubleshooting and resolving the subject problem. I can give more details as necessary. (Please advise if I should post this problem to a more specific group.) Here's the situation in a nutshell. We're using WinXP Pro workstations configured to a common standard on a nation-wide intra-network and we recently migrated one operation involving networking with a WinNT server (with...
11
3855
by: JCav | last post by:
I need to call a COM object from a remote machine using C#. I also need to pass on a different userID and password to the call. Has anyone done this? I've used Java to do this using JIntegra, but the application I'm using requires .NET. Any advice?
1
3574
by: =?Utf-8?B?c3VidGlsZQ==?= | last post by:
Hi :-) I'm having some trouble with LDAP and Active Directory on Win2k3 I use Windows Authentication and the code System.Threading.Thread.CurrentPrincipal.Identity.Name gives me the correct credentials when logged in. When I create user in AD i get an error. I have 4 scenarioes - one work and one don't. I'm very confused:
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9533
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10461
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10190
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.