By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,918 Members | 1,923 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,918 IT Pros & Developers. It's quick & easy.

How to use membership without Login Controls

P: n/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).
Jan 25 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Looks fine to me, as long as it returns true or false.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ad" wrote:
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).

Jan 26 '06 #2

P: n/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?

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> glsD:3E********************************* *@microsoft.com...
Looks fine to me, as long as it returns true or false.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ad" wrote:
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).

Jan 26 '06 #3

P: n/a
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


"ad" wrote:
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?

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> ¼¶¼g©ó¶l¥ó·s»D:3E*********************** ***********@microsoft.com...
Looks fine to me, as long as it returns true or false.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ad" wrote:
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).


Jan 27 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.