c# - IIS vs. localhost Context.User.IsInRole() -


I used this code to simplify my problem:

  & lt ;% @ Page Language = "C #"%> & Lt ;! DOCTYPE HTML PUBLIC "- // W3C // DTD HTML 4.0 Transcription // N" & gt; & Lt; Html & gt; & Lt; HEAD & gt; & Lt; Title & gt; I am I & lt; / Title & gt; & Lt; Script language = "c #" runat = "server" & gt; Private Zero Page_load (Object Sender, System.EventArgs E) {Label2.Text = "I am" + HttpContext.Current.User.Identity.Name; Bool Results = Reference. the user. ISIR (HTTTEXT.content.USIRIIDANDITYNAME.name); Label1.Text = "What am I?" result; Results = HttpContext.Current.User.IsInRole (HttpContext.Current.User.Identity.Name); Label1.Text + = "Am I myself?" result; } & Lt; / Script & gt; & Lt; / HEAD> & Lt; Body & gt; & Lt; Form id = "form1" runat = "server" & gt; & Lt; Div & gt; & Lt; ASP: label ID = "label 2" run = "server" text = "label" & gt; & Lt; / Asp: label & gt; & Lt; / Div & gt; & Lt; Div & gt; & Lt; ASP: label ID = "label 1" runat = "server" width = "100%" height = "280px" & gt; & Lt; / ASP: Labels & gt; & Lt; / Div & gt; & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

When I run this code locally, it works fine:

Does anyone know what's going on?

I'm using windows-intersection on intranet sites for clarification. Apart from the username on both the matches

You are asking that the user is in the Windows group the user has the same name

< From p> to IsInRole :

it determines that the current principal belongs to the user group with the specified user name.

I suspect it works on your local machine, that your user should have a group with the same name and your user is also a member of this group .


Comments

Popular posts from this blog

c# - XML serialize base class without knowing derived class -

c# - UnhandledExceptionMode.ThrowException for AppDomain.UnhandledException -

udp - The relationship between MTU and size of skb in xmit function -