Click here to Skip to main content
15,895,084 members
Home / Discussions / C#
   

C#

 
AnswerRe: Try/Catch Variable Scoping Pin
Guffa17-Jan-06 12:14
Guffa17-Jan-06 12:14 
GeneralRe: Try/Catch Variable Scoping Pin
RobertF5717-Jan-06 12:38
RobertF5717-Jan-06 12:38 
QuestionSetup Project - Getting the user selected install directory Pin
dotnetprgrmmr17-Jan-06 11:28
dotnetprgrmmr17-Jan-06 11:28 
AnswerRe: Setup Project - Getting the user selected install directory Pin
Sasuko17-Jan-06 11:48
Sasuko17-Jan-06 11:48 
GeneralRe: Setup Project - Getting the user selected install directory Pin
dotnetprgrmmr17-Jan-06 12:00
dotnetprgrmmr17-Jan-06 12:00 
GeneralRe: Setup Project - Getting the user selected install directory Pin
Sasuko17-Jan-06 12:42
Sasuko17-Jan-06 12:42 
GeneralRe: Setup Project - Getting the user selected install directory Pin
dotnetprgrmmr18-Jan-06 6:09
dotnetprgrmmr18-Jan-06 6:09 
QuestionDatabase VS direct update Pin
Sasuko17-Jan-06 11:19
Sasuko17-Jan-06 11:19 
AnswerRe: Database VS direct update Pin
Guffa17-Jan-06 11:54
Guffa17-Jan-06 11:54 
GeneralRe: Database VS direct update Pin
Sasuko17-Jan-06 12:14
Sasuko17-Jan-06 12:14 
GeneralRe: Database VS direct update Pin
Dave Kreskowiak17-Jan-06 17:25
mveDave Kreskowiak17-Jan-06 17:25 
AnswerRe: Database VS direct update Pin
Guffa19-Jan-06 23:03
Guffa19-Jan-06 23:03 
QuestionMaking the panel invisible?? Pin
VPMahank17-Jan-06 11:12
VPMahank17-Jan-06 11:12 
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 

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.