Role Varification in OnloggedIn event

Posted on 2006-11-21
Medium Priority
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"))



if (Roles.IsUserInRole("employer"))




"UIDGuid", userId);
Question by:Scripter25
  • 2
LVL 12

Expert Comment

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


Author Comment

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





 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?

LVL 12

Accepted Solution

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.

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.

607 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