470,581 Members | 2,427 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,581 developers. It's quick & easy.

Membership Provider

Hi,

I use custom membership provider and custom role provider to manage users of my application. In web.Config I use Form Authentication and define both providers as my default membership and role providers (I have implemented both providers in different class) now.. In Authorization section of web.config, i specifically state only allow roles = A, B . and i also specify for membership provider the name of the application of this web application (I use the smae custom data store and membership provide & role provider fro more than 1 web application)

this particular web app has its own name let say X. I specify X in web.config in membershipprovider section. Now let's say that a person is in the database, he logged in and becuase the password he supplied was correct, his name was written in the login control but he is still in login.aspx and can't move to other page. the reason being that his role denies him for using this web app but because he is a validate user (found in db with matching username and password) the login control does not throw any error message. I want to show this error message just like when people input wrong anme or password.. How can i do that ?

Thanks before
Jul 21 '08 #1
1 919
got it !

protected void Page_Load (Objects Sender, EventArguments e)
{
if (User.IsAuthenticated)
{
if (!User.IsInRole("A") && !User.IsInRole("B"))
lblMessage.Text="You are not allowed to access";
}
}
Jul 29 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Morgan | last post: by
2 posts views Thread by John | last post: by
9 posts views Thread by Paul Keegstra | last post: by
3 posts views Thread by ryan.mclean | last post: by
4 posts views Thread by thomas | last post: by
4 posts views Thread by =?Utf-8?B?Q2hyaXMgQ2Fw?= | last post: by
6 posts views Thread by Jonathan Wood | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.