473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Impersonate User asp.net

Hi...

Okay this is driving me mad. I have a very simple webpage served up from my
webserver which uses the following code to populate 3 labels.

lblOne.Text = Page.User.Identity.Name
lblTwo.Text = System.Security.Principal.WindowsIdentity.GetCurre nt().Name
lblThree.Text = System.Threading.Thread.CurrentPrincipal.Identity. Name

In my web.config file I have :-

<authentication mode="Windows" />
<identity impersonate="true"/>

<authorization>
<deny users = "?" />
<allow users ="*" />
</authorization>

So when i call the url to display the page from my machine the labels are
populated as below:-

someserver\administrator
someserver\administrator
someserver\administrator

but i was expecting the identity of the person calling the webpage something
like:-

ad\rich

What am i doing wrong or have i totally failed to grasp the impersonating
topic at all. I am running Windows 2003 with IIS 6

Any help would be very much appreciated.

Many thanks

R
Nov 19 '05 #1
6 3074
Is anonymous access enabled in IIS ?
--
Patrice

"richi" <ri***@discussions.microsoft.com> a écrit dans le message de
news:07**********************************@microsof t.com...
Hi...

Okay this is driving me mad. I have a very simple webpage served up from my webserver which uses the following code to populate 3 labels.

lblOne.Text = Page.User.Identity.Name
lblTwo.Text = System.Security.Principal.WindowsIdentity.GetCurre nt().Name
lblThree.Text = System.Threading.Thread.CurrentPrincipal.Identity. Name

In my web.config file I have :-

<authentication mode="Windows" />
<identity impersonate="true"/>

<authorization>
<deny users = "?" />
<allow users ="*" />
</authorization>

So when i call the url to display the page from my machine the labels are
populated as below:-

someserver\administrator
someserver\administrator
someserver\administrator

but i was expecting the identity of the person calling the webpage something like:-

ad\rich

What am i doing wrong or have i totally failed to grasp the impersonating
topic at all. I am running Windows 2003 with IIS 6

Any help would be very much appreciated.

Many thanks

R

Nov 19 '05 #2

Hi Rich,
Do you mean you logged in using your domain account? or the local
administrator of the server?
Do you have the same response if you deployed this code in another
server/workstation?
Mohamed Sharaf
MEA Developer Support Center
ITWorx on behalf Microsoft EMEA GTSC
--------------------
| Thread-Topic: Impersonate User asp.net
| thread-index: AcXObuOLzHxVX2J+T6G7GmZT5b2mTQ==
| X-WBNR-Posting-Host: 195.245.247.40
| From: "=?Utf-8?B?cmljaGk=?=" <ri***@discussions.microsoft.com>
| Subject: Impersonate User asp.net
| Date: Tue, 11 Oct 2005 07:20:10 -0700
| Lines: 41
| Message-ID: <07**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSF TNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:349968
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi...
|
| Okay this is driving me mad. I have a very simple webpage served up from
my
| webserver which uses the following code to populate 3 labels.
|
| lblOne.Text = Page.User.Identity.Name
| lblTwo.Text = System.Security.Principal.WindowsIdentity.GetCurre nt().Name
| lblThree.Text = System.Threading.Thread.CurrentPrincipal.Identity. Name
|
| In my web.config file I have :-
|
| <authentication mode="Windows" />
| <identity impersonate="true"/>
|
| <authorization>
| <deny users = "?" />
| <allow users ="*" />
| </authorization>
|
| So when i call the url to display the page from my machine the labels are
| populated as below:-
|
| someserver\administrator
| someserver\administrator
| someserver\administrator
|
| but i was expecting the identity of the person calling the webpage
something
| like:-
|
| ad\rich
|
| What am i doing wrong or have i totally failed to grasp the impersonating
| topic at all. I am running Windows 2003 with IIS 6
|
| Any help would be very much appreciated.
|
| Many thanks
|
| R
|
|
|

Nov 19 '05 #3
Hello and thanks for replying.

I can confirm that the virtual directory running under IIS6 on my server has
annonymous authentication disabled and windows integrated security enabled.

I am attempting to browse to the virtual directory on the server from my
machine and was expecting to see the useridentity as my domain logon but i
get the domain logon of the administrator of the server where the virtual
directory resides.

Very confused!

Thanks

Rich
Nov 19 '05 #4
Do you use a virtual directory that points to another server ? Is the
credentials you see those you entered to get access to this remote directory
?

What if you try an ASPX page that is really on the Web server ?

It would likely helps to narrow down the problem. For now it would make me
think that when accessing another server the identity is the one used to
connect to the virtual directory not the original. For now I have never done
that (my personal preference is to have identically set up sites and to
share only data, not code between servers).

Try also to check ServerVariables("LOGON_USER") or similar...

Good luck
--

Patrice

"richi" <ri***@discussions.microsoft.com> a écrit dans le message de
news:6C**********************************@microsof t.com...
Hello and thanks for replying.

I can confirm that the virtual directory running under IIS6 on my server has annonymous authentication disabled and windows integrated security enabled.
I am attempting to browse to the virtual directory on the server from my
machine and was expecting to see the useridentity as my domain logon but i
get the domain logon of the administrator of the server where the virtual
directory resides.

Very confused!

Thanks

Rich

Nov 19 '05 #5
Thanks Patrice

I have moved the code to another server and set up a virtual directory on
that server with the same code and disabled annonymous authentication and
everything works fine now... i can see the local login of the person
requesting the page.

My problem is I need it to work from the other server. For some reason it
shows me that the server administrator is the one requesting the page... ie
server\administrator instead of AD\richi.

I know its not the code and I know I have the security settings correct as I
have replicated on the other server. All requests to the web page seem to be
authenticated as the servers administrator instead of the local machine login.

Even more confused...

Thanks

Rich
Nov 19 '05 #6

Hi Rich,
This makes me think of the machine.config file resides in the %System
folder%\Microsoft.Net\Framework\%Framework version%\Config.
Please revise the <system.Web> tag and the <location> tag just above it
<location allowOverride="true">
<system.web>

Make sure that allowOverride=true not false and check the settings under
System.Web to see if there's something different than the other server.

Thanks,
Mohamed Sharaf
MEA Developer Support Center
ITWorx on behalf Microsoft EMEA GTSC
--------------------
| Thread-Topic: Impersonate User asp.net
| thread-index: AcXOgOSy9G1OQwUJTgOaQrFvlZIWtw==
| X-WBNR-Posting-Host: 195.245.247.40
| From: "=?Utf-8?B?cmljaGk=?=" <ri***@discussions.microsoft.com>
| References: <07**********************************@microsoft.co m>
<71**************@TK2MSFTNGXA02.phx.gbl>
<6C**********************************@microsoft.co m>
<OB**************@TK2MSFTNGP09.phx.gbl>
| Subject: Re: Impersonate User asp.net
| Date: Tue, 11 Oct 2005 09:29:03 -0700
| Lines: 20
| Message-ID: <5C**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:350041
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks Patrice
|
| I have moved the code to another server and set up a virtual directory on
| that server with the same code and disabled annonymous authentication and
| everything works fine now... i can see the local login of the person
| requesting the page.
|
| My problem is I need it to work from the other server. For some reason it
| shows me that the server administrator is the one requesting the page...
ie
| server\administrator instead of AD\richi.
|
| I know its not the code and I know I have the security settings correct
as I
| have replicated on the other server. All requests to the web page seem to
be
| authenticated as the servers administrator instead of the local machine
login.
|
| Even more confused...
|
| Thanks
|
| Rich
|

Nov 19 '05 #7

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

Similar topics

1
by: moemeelaung | last post by:
Hi ASP/Windows experts out there I really need help with this Impersonate function. I have machine A and B. A hosts my ASP page which is to create a user account on the machine B. The...
14
by: Ian Frawley | last post by:
Anyone used the WindowsIdentity class with success? I find if I try to change the current identity to one that exists on another machine and then try to perform and action on that machine i.e....
8
by: BLiTZWiNG | last post by:
After playing with the code shown and utilising Willy Denyottes' help, I have come to the conclusion that there is some form of difference between the managed WindowsIdentity.Impersonate() over the...
4
by: Alvaro Pereira | last post by:
I have a ASP.NET project that prints a report to a NETWORK- PRINTER. I have impersonate=true in my web.config, but all reports are printed under ASPNET user (the one that is setted in...
6
by: Mark | last post by:
We are attempting to use impersonation to connect from our ASP.NET website to a SQL Server on the same domain. The code below works just fine in our web.config file: <identity impersonate="true"...
6
by: Erez Shor | last post by:
Hi, I need to build and asp page which access a remote windows server's registry and create a registry key. In order for the ASP page to be able to access the registry on the remote server I need...
1
by: Svein Terje Gaup | last post by:
I have a website running on Windows 2000 Server, that should be able to retrieve data from a datawarehouse on another machine running Windows 2000 Server, SQL Server 2000 and SQL Server 2000...
8
by: RTT | last post by:
i'm writing a windows form but codebased a iwant to run the code as a different user. like in a webapplication you can impersonate a user so the website does not run on the standard ASP.NET...
2
by: rockdale | last post by:
Hi, all: My asp.net application calles MS speech 5.1 and generate a wav file on server's path. Everything runs perfectly on my development machine. But when I move the appl to production server,...
4
by: =?Utf-8?B?QXZhRGV2?= | last post by:
ASP.Net 2. We are migrating to Windows 2008 64 bit Server with IIS 7 from Windows 2003 32 Bit with IIS 6. A few library classes we wrote uses impersonation in code like explained in this...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.