Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Create user

Reply
Thread Tools

Create user

 
 
shapper
Guest
Posts: n/a
 
      11-01-2008
Hello,

I have created a class that inherits MembershipUser:
public class UserHelper : MembershipUser {
....

Then I am creating a user as follows:
UserHelper user = (UserHelper)Membership.CreateUser("me", "pass",
"", null, null, true, null, out status);

Membership.CreateUser returns a MembershipUser

But I get an error:
Unable to cast object of type 'System.Web.Security.MembershipUser' to
type 'MyApp.Security.Membership.UserHelper'.

If I don't cast it, which means, using:
UserHelper user = Membership.CreateUser("me", "pass", "",
null, null, true, null, out status);

It does not compile and I get the error:
Cannot implicitly convert type 'System.Web.Security.MembershipUser' to
'MyApp.Security.Membership.UserHelper'. An explicit conversion exists
(are you missing a cast?)

What am I doing wrong?

Thanks,
Miguel
 
Reply With Quote
 
 
 
 
Fred
Guest
Posts: n/a
 
      11-03-2008
in news:466b3948-88ef-40fb-86f9-,
shapper wrote :

> Hello,


Hello,

> I have created a class that inherits MembershipUser:
> public class UserHelper : MembershipUser {
> ...
>
> Then I am creating a user as follows:
> UserHelper user = (UserHelper)Membership.CreateUser("me", "pass",
> "", null, null, true, null, out status);
>
> Membership.CreateUser returns a MembershipUser



If you want CreateUser to return a UserHelper, I think you should also
inherits MemberShipProvider.

--
Fred


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Api to create document and add,edit,delete text and t Krithika San Ruby 3 11-14-2009 09:29 PM
How can i create new users without utilizing the create user wizar prady ASP .Net 2 12-29-2007 10:46 PM
Can I create a Create .NET 1.1 project in VS2005? JB ASP .Net 1 12-14-2007 10:53 AM
How to create python script which can create csv we file with relationship Sonu Python 1 08-03-2007 01:08 PM
problem: create element in create element Iulian Ilea Javascript 4 12-17-2006 12:00 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57