How to use membership without Login Controls

A

ad

I have create a custom membership provider.
The common usage of custom membership is set it as default Membership
Provider win web.config, and use login controls with it.

How can I use custom membership provider without Login Controls?

For example, the name of my custom membership provider MyMembershipProvider.
Is the codes below right?

MyMembershipProvider myProvider=new MyMembershipProvider();
myProvider.ValidateUser(myUserID, myPassWord).
 
A

ad

Thank, but it fall:

I have created a custom Membership Provider, and set it as default
membership provider in web.config.

I have also set deny users ="?" in web.config.

When I use a login control with it, it work fine. but now I want to valid
with code like:

MyMembershipProvider myProvider = new MyMembershipProvider();
if (myProvider.ValidateUser("myid", "mypw"))
{
Response.Redirect("~/Home.aspx");
}

The ValidateUser return true, but it can't redierct to home.aspx.

I find the page.user.identity.name is none after ValidateUser, but if I use
login controls, the Page.User.Identity will set to the login id after valid.

How can I do?
 
G

Guest

Ad,
I believe I already responded to this in another post, but here goes:
If you are doing 100% custom authentication, then once you've validated the
username / password you need to create the FormsAuthentication ticket
yourself also. Take a look at the documentation for FormsAuthentication class
- it has all the methods and sample code.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top