Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to set the current user httpcontext.current.user asp.net -mvc

String[] newRoles = { "Administrator", "Customer" };
GenericIdentity newIdentity = new GenericIdentity(model.AccountName);
GenericPrincipal newPrincipal = new GenericPrincipal(newIdentity, newRoles);                       
System.Web.HttpContext.Current.User = newPrincipal;  
Comment

PREVIOUS NEXT
Code Example
Csharp :: Response.Redirect cannot be called in a Page callback 
Csharp :: rows and columns arrays 
Csharp :: Get a list of distinct values in List 
Csharp :: c# copy bidimensional array 
Csharp :: dictionary.add values to array c# 
Csharp :: c# winforms datagridview bind to list 
Csharp :: c# response.contenttype set filename 
Csharp :: c# list contains null 
Csharp :: c# get all occurrences of a string 
Csharp :: unity3d gameobject follow path 
Csharp :: subtract to time c# 
Csharp :: convert rgb to float 
Csharp :: Generic Stack 
Csharp :: runtime save scene unity 
Csharp :: c# Write a program to reverse an array or string 
Csharp :: docker-compose cassandra db 
Csharp :: catch multiple exception c# 
Csharp :: get xml from url 
Csharp :: datatable select c# 
Csharp :: link list in c# 
Csharp :: exception 
Csharp :: c# quick "is" "as" 
Csharp :: dataannotations for currency in c# 
Csharp :: Archivarskodex freischalten 
Csharp :: c# on alt + f4 
Csharp :: C# HttpUtility not found / missing C# 
Csharp :: turnary operator c# 
Csharp :: c# windows forms how to get controls in gropu box 
Csharp :: .net core 3 entity framework constraint code first image field 
Csharp :: select every second row in html table 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =