Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
AnswerRe: Making the panel invisible?? Pin
CWIZO17-Jan-06 21:11
CWIZO17-Jan-06 21:11 
GeneralRe: Making the panel invisible?? Pin
VPMahank18-Jan-06 1:32
VPMahank18-Jan-06 1:32 
QuestionHow can an NT Service cause itself to stop? Pin
dotnetprgrmmr17-Jan-06 11:12
dotnetprgrmmr17-Jan-06 11:12 
Questionfloating toolbar in C# Pin
jerryyag17-Jan-06 11:00
jerryyag17-Jan-06 11:00 
AnswerRe: floating toolbar in C# Pin
Sasuko17-Jan-06 11:44
Sasuko17-Jan-06 11:44 
AnswerRe: floating toolbar in C# Pin
mav.northwind17-Jan-06 20:48
mav.northwind17-Jan-06 20:48 
GeneralRe: floating toolbar in C# Pin
jerryyag18-Jan-06 4:41
jerryyag18-Jan-06 4:41 
QuestionCasting in Global.asax Pin
eggsovereasy17-Jan-06 10:54
eggsovereasy17-Jan-06 10:54 
In global.asax I have:

<br />
protected void Application_AuthenticateRequest(Object sender, EventArgs e)<br />
{<br />
	//Create an instance of HttpApplication.<br />
	HttpApplication app = (HttpApplication) sender;<br />
<br />
	if(app.Request.IsAuthenticated)<br />
	{<br />
	        //If sender is authenticated, an instance of CustomPrincipal is created.<br />
		CustomPrincipal ppal = new CustomPrincipal( Context.User.Identity.Name.ToString(), ((CustomIdentity)Context.User.Identity).ProjectID );<br />
				<br />
		//Set Context User to CustomPrincipal.<br />
		Context.User = ppal;<br />
	}<br />
}<br />


But when I attempt to go to a page it throws a "Specified cast is not valid" on this line: CustomPrincipal ppal = new CustomPrincipal( Context.User.Identity.Name.ToString(), ((CustomIdentity)Context.User.Identity).ProjectID );

CustomIdentity is an IIdentity with some extra stuff in it.

What I am trying to do is have one web site that is a work flow managment program, but will encompas several projects. So on the login page you put in a username and password then select a project from a drop down list and it authenticates the user based on whether they have a role in this project (junction table). The project id needs to be readily available on a per user basis as every stored procedure has project id as a parameter so that only data relevent to the given project is displayed.

Is there a better way to handle this situation or a way to make Project id available from context as well as be nessesary to make a Principal or Identity object.

-- modified at 16:54 Tuesday 17th January, 2006
AnswerRe: Casting in Global.asax Pin
Guffa17-Jan-06 12:01
Guffa17-Jan-06 12:01 
GeneralRe: Casting in Global.asax Pin
eggsovereasy20-Jan-06 9:29
eggsovereasy20-Jan-06 9:29 
QuestionChanging the computer name using C# Pin
mdemercado17-Jan-06 10:40
mdemercado17-Jan-06 10:40 
AnswerRe: Changing the computer name using C# Pin
SimonS17-Jan-06 10:46
SimonS17-Jan-06 10:46 
QuestionPropertygrid ExpandableObjectConverter Question??? Pin
qwerty666@codeproject.com17-Jan-06 10:32
qwerty666@codeproject.com17-Jan-06 10:32 
QuestionHow to get the Hard Disk or Mother Board Id through C# Pin
moonangel_bio17-Jan-06 10:12
moonangel_bio17-Jan-06 10:12 
AnswerRe: How to get the Hard Disk or Mother Board Id through C# Pin
SimonS17-Jan-06 10:34
SimonS17-Jan-06 10:34 
GeneralRe: How to get the Hard Disk or Mother Board Id through C# Pin
Dave Kreskowiak17-Jan-06 10:36
mveDave Kreskowiak17-Jan-06 10:36 
JokeRe: How to get the Hard Disk or Mother Board Id through C# Pin
SimonS17-Jan-06 10:42
SimonS17-Jan-06 10:42 
AnswerRe: How to get the Hard Disk or Mother Board Id through C# Pin
Dave Kreskowiak17-Jan-06 10:35
mveDave Kreskowiak17-Jan-06 10:35 
GeneralRe: How to get the Hard Disk or Mother Board Id through C# Pin
Dan Neely17-Jan-06 10:40
Dan Neely17-Jan-06 10:40 
GeneralRe: How to get the Hard Disk or Mother Board Id through C# Pin
Dave Kreskowiak17-Jan-06 11:47
mveDave Kreskowiak17-Jan-06 11:47 
QuestionHow to Change the Mouse Cursor outside the WinForm using C#? Pin
Khanh.p17-Jan-06 9:36
Khanh.p17-Jan-06 9:36 
AnswerRe: How to Change the Mouse Cursor outside the WinForm using C#? Pin
Christian Graus17-Jan-06 9:54
protectorChristian Graus17-Jan-06 9:54 
AnswerRe: How to Change the Mouse Cursor outside the WinForm using C#? Pin
Tom Larsen17-Jan-06 10:42
Tom Larsen17-Jan-06 10:42 
GeneralRe: How to Change the Mouse Cursor outside the WinForm using C#? Pin
Khanh.p17-Jan-06 15:17
Khanh.p17-Jan-06 15:17 
QuestionIE text boxes Pin
sowhatman0017-Jan-06 8:33
sowhatman0017-Jan-06 8:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.