Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Role Varification in OnloggedIn event

Posted on 2006-11-21
3
Medium Priority
?
588 Views
Last Modified: 2008-08-23
The below code is not working for me at all. it gets to the if statement and reads it as false for both of the if statements. although if I manually set it up to go to a specific page after login and on that page provide a list box that displays the roles that the current user is in it will show the correct roles. Is this an issue with just the way that the Onloggedin event works?


protected void OnLoggedin(object sender, EventArgs e)
{


if (Roles.IsUserInRole("registered"))
{

Response.Redirect(

"~/home.aspx");
}


if (Roles.IsUserInRole("employer"))
{

Response.Redirect(

"~/employers/myprofile.aspx");
}

Session.Add(

"UIDGuid", userId);
}
0
Comment
Question by:Scripter25
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Expert Comment

by:sandip132
ID: 17992565
Roles.IsUserInRole will be false if the page does not postback to the server.

Cheers!!!
0
 

Author Comment

by:Scripter25
ID: 17992685
So forgive me if I am missing something but what you are saying overall is I would have to technically either have the form post back to itself and do a

if(isPostback)

{

if(Roles.IsUserInRole(Login1.UserName,"employer"))
{

 

 Or place the code onto the page load of whatever page I want it to post to. possibly a simple page that just decides where to send the user from there?

0
 
LVL 12

Accepted Solution

by:
sandip132 earned 2000 total points
ID: 17992763
You can choose any option where the code will get executed as a result of postback.

Try debugging.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question