How to use membership provider with login control

A

ad

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 use Membership Provider without login control?
 
G

Guest

ad,
If you want to do everything programmatically, then you need to use this in
conjunction with the FormsAuthentication class and methods. once you validate
a user ("true") you need to create a new FormsAuthentication ticket and so on.
Suggest you do some reading up in the documentation.

Peter
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top