Re: Help to Get User Name And their roles ! Urgent

From: rama (ramakrishnam@indosoft.stph.net)
Date: 04/25/03


From: "rama" <ramakrishnam@indosoft.stph.net>
Date: Fri, 25 Apr 2003 11:10:16 +0530


Hi All:

Thanx for ur suggestions. This is my code. Iam getting user name and domain
also. But iam not getting

the user name which i entered when iam autheticated thorugh IIS, after
setting Integrated Windown

Authentication on. For eg: Iam in groupware domain and the user name is
rama...So i should get user

name as rama, but iam getting user name as SYSTEM.From where it's getting
the user name as

SYSTEM.WHY is it so? Please help me out to get rid of this problem.

<%@ Import Namespace="System.Security.Principal" %>
<html>
<script runat="server">
sub Page_Load(o as object, e as eventargs)
dim uns
'uns=User.Identity.Name
uns=CType(User.Identity,WindowsIdentity)
dim uns1
uns1=uns.GetCurrent()
response.write(uns1.Name)
dim str1() as string
str1=Microsoft.VisualBasic.Split(uns1.Name,"\")
response.write(str1(1))
response.write(uns1.IsAuthenticated)
response.write(User.IsInRole("BUILTIN\Adminitrators"))
end sub
</script>
</html>

****** Iam getting the output as follows:

NT AUTHORITY\SYSTEM

SYSTEM

True

False

**********************************
Thanx In Advance

Rama Krishna.M

"szabelin" <szabelin@cal.berkeley.edu> wrote in message
news:05bf01c30a93$0beae6c0$2f01280a@phx.gbl...
>
> Hi try going to your IIS -> right click on your folder ->
> Properties -> Directory Security -> Edit
>
> And set Integrated Windows Authentication to ON
>
> I did that in my case and I get IIdentity object set with
> user name and so on
>
> Hope this helps you too
> Sergey
>
>
>
> >-----Original Message-----
> >Hi All:
> >
> >Iam unable to get the user name and their active role in
> a web form from
> >asp.net. I have used user.identity.name to get the user
> name. Iam using
> >Vb.net as a language in asp.net. But nothing is displayed
> by using the
> >mentioned property. Actually what i need is, i want to
> know the user name
> >who had enter into my site, and his/ her pariticular role
> through windows
> >authentication. If i know the
> >role and user name, then accordingly, i'll restrict the
> forms to show to
> >that particualr user according to their priveleges. Iam
> using Win-2000
> >Server as OS. Could anyone come across
> >this problem. Please help me out.
> >
> >Thanx in advance
> >
> >Best Regards
> >Rama Krishna.M
> >
> >
> >.
> >



Relevant Pages

  • runtime error in my application
    ... when iam running a process called convertin my application ... which is to convert data from excel sheet to sql server table it's giving me ... This process is to convert data From EXcel file to ... Dim oSheet As Excel.Worksheet ...
    (microsoft.public.vb.bugs)
  • Re: gettting user name in asp.net
    ... Iam getting user name and domain> also. ... > name as rama, but iam getting user name as SYSTEM.From where it's getting> the user name as ... > sub Page_Load> dim uns ...
    (microsoft.public.dotnet.security)
  • runtime error in application
    ... when iam running a process called convertin my application ... which is to convert data from excel sheet to sql server table it's giving me ... This process is to convert data From EXcel file to ... Dim oSheet As Excel.Worksheet ...
    (microsoft.public.vb.bugs)
  • runtime error in the application
    ... when iam running a process called convertin my application ... which is to convert data from excel sheet to sql server table it's giving me ... This process is to convert data From EXcel file to ... Dim oSheet As Excel.Worksheet ...
    (microsoft.public.vb.bugs)
  • Re: Creating one file out of many, including the filename
    ... John - hoe exactly do I run this code in access? ... > Dim fso 'As FileSystemObject ... > And here (this is why I prefer Perl for little utilities) is a Perl ... >>I have several hundred .csv files that Iam trying to combine in one file. ...
    (microsoft.public.access.externaldata)