C# - Inherit SqlMembershipProvider And Disable CreateUser() And DeleteUser()?

Mar 2, 2011

I want to inherit SqlMembershipProvider, setup the membership settings to use the derived custom provider, and prohibit someone from calling Membership.CreateUser() and Membership.DeleteUser().I have an external application that will offer a user add/delete mechanism that does more than what built-in Membership does.I was able to override the CreateUser() and DeleteUser() to throw NotSupportedExceptions when Membership.CreateUser() or Membership.DeleteUser() is called.I then tried 2 custom methods and had each invoke base.CreateUser() and base.DeleteUser() but got null exceptions. I believe the issue is the base methods are only accessible by the overridden functions and not the custom onesMy code is below:

public class UserMembershipSQL : SqlMembershipProvider
{
internal MembershipUser CreateUserCustom(string username, string password, string email, string

[code]...

View 3 Replies


Similar Messages:

Membership.deleteuser() Returning False - Not Deleting The User

Nov 21, 2010

I am trying to delete an asp.net user from all tables. When I call: bool isDeleted = Membership.DeleteUser(username, true); isDeleted is being set to false; Is there a way to tell why it is not deleting the user?

View 4 Replies

Security :: Membership.DeleteUser Not Removing User From Database

Jun 29, 2010

Membership.DeleteUser not removing user from database

//Roles.RemoveUserFromRole("markwheeler1963@hotmail.com", "customer");

View 6 Replies

Security :: Membership.DeleteUser Throws Exception When Website Is Published

Mar 29, 2010

I am using Membership.DeleteUser("username",true) method to delete the user from DataBase. This works fine in my local machine. When i publish the same code, i am not able to delete the user..... it throws an javascript error saying..... "Login failed for user NT AUTHORITY/NETWORK SERVICE"

View 5 Replies

User Still Exists In Roles.GetUsersInRole After DeleteUser() With DeleteAllRelatedData = False

Jan 13, 2010

I have an account called "admintest" which is "admin" as its role. I called the following line to delete the user with deleteAllRelatedData=false because I just want to mark the user as deleted (I may need to retrieve users' history later)

bool result = Membership.DeleteUser("admintest", false);

After that, I call the following line to get the user:

string[] users = Roles.GetUsersInRole("admin");

But I still get "admintest" in the users array.

View 1 Replies

C# - Membership.DeleteUser (UserName,true) Not Removing User From Role

Mar 25, 2011

When I click the "delete" linkbutton, it can delete the all User info from my "UserDetail" table in my "JobPost.mdf", it also delete the corresponding "aspnet_Users" & "aspnet_Membership",but the "UserInRole" still contain that UserName. Even though I specified the Code:Membership.DeleteUser(UserName, true);

I thought true is for bool deleteallrelated data, but it doesn't really delete the userInRole. So next time the user registers with the same name, it automatically get the "admin" role right. This "deleteUser" page I keep it inside a protected "admin"folder. How to solve it? Why Membership.DeleteUser(UserName, true) doesn't delete UserInRole?

protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
string UserName = e.CommandArgument.ToString();
Membership.DeleteUser(UserName, true);
JobPostDataContext db = new JobPostDataContext();
var query = from u in db.UserDetails
where u.UserName == UserName
select u;
foreach (var item in query)
{
db.UserDetails.DeleteOnSubmit(item);
}
db.SubmitChanges();
FormsAuthentication.SignOut();
}
}
My web.config inside the protected Admin folder:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<authorization>
<allow roles="Administrators" />
<deny users="*" />
</authorization>
</system.web>
</configuration>

View 1 Replies

Security :: Upgrade To SqlMembershipProvider?

Sep 7, 2010

I've been given the task to update an existing website. Currently the website has a login only for administrators. They administer everything on the site, including all "Artist" data. This is done using simple form authentication and custom user table. Right now the "users" table only has one record since all administrators use the same username/password (not good, I know). As the "new" developer, I've been asked to update this site to allow the "Artists" to register themselves, and be able to update their own information. Ideally I want to get rid of all the current security, and use the SqlMembershipProvider. My issue? I have the database added to my schema, but I'm assuming something else within the site is confused. When I try and use the ASP.NET I get an error: "Configured settings are invalid: Hashed passwords cannot be retrieved. Either set the password format to different type, or set supportsPasswordRetrieval to false.(C:Inetpubwwwrootsitessite1web.config line 21)

Right now there are no users, no applicatins even set up in the sQLMembershipProvider tables. I've been following the MSDN site, as well as some secuity tutorials on this site (ASP.NET), but none of the solutions suggested works for me. I've created a "Register.aspx"
page, and when I load it I get this error: "Configured settings are invalid: Hashed passwords cannot be retrieved. Either set the password format to different type, or set supportsPasswordRetrieval to false."

Here's part of my web.conf file:

[Code]....

View 2 Replies

Security :: Membership.DeleteUser (UserName,true) Not Removing User From Role

Mar 25, 2011

I have a "UserDetail" table in my "JobPost.mdf". When I click the "delete" linkbutton, it can delete the all User info from my "UserDetail" table, it also delete the corresponding "aspnet_Users" & "aspnet_Membership",but the "UserInRole" still contain that UserName. Even though I specified the Code:Membership.DeleteUser(UserName, true);

I thought true is for bool deleteallrelated data, but it doesn't really delete the userInRole. So next time the user registers with the same name, it automatically get the "admin" role right. This "deleteUser" page I keep it inside a protected "admin"folder. How to solve it? Why Membership.DeleteUser(UserName, true) doesn't delete UserInRole?

protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
string UserName = e.CommandArgument.ToString();
Membership.DeleteUser(UserName, true);
JobPostDataContext db = new JobPostDataContext();
var query = from u in db.UserDetails
where u.UserName == UserName
select u;
foreach (var item in query)
{
db.UserDetails.DeleteOnSubmit(item);
}
db.SubmitChanges();
FormsAuthentication.SignOut();
}
}
My web.config inside the protected Admin folder:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<authorization>
<allow roles="Administrators" />
<deny users="*" />
</authorization>
</system.web>
</configuration>

View 1 Replies

Membership/SQLMembershipProvider Source Code

Jul 3, 2010

In the SQLMembershipProvider source for ASP.NET membership, there is a custom exception, MembershipPasswordException.

The definition of it is not part of the source, but when I do a goto definition on it, it opens the definition, which indicates: [from metatdata] and the file it came from is a dll, system.web.dll from a temporary directory.How did that get there or was it part of the msi install that the toolkit provider came with?

View 2 Replies

Using SqlMembershipProvider When ActiveDirectoryProvider Fails To Log A User In?

Aug 16, 2010

I have a requirement to allow access to an app with users being authenticated by AD. Sadly, not all of the users who can access the app will have been authenticated this way so I need to provide a mechanism whereby if a user arrives as the site their authentication is checked using AD and if it fails, they are handed off to a login page that will attempt to authenticate them using the SqlMembershipProvider.

So, to my questions: how do I go about configuring it? If I want to use profiles, can both membership providers share one set of profile tables (stored in SQL)?

View 1 Replies

.net - Add Additional Security Questions To SqlMembershipProvider?

Mar 21, 2011

The default asp membership provider only allows for one security question and answer. Does anyone know a work around to allow for more than one question and answer?

View 1 Replies

Security :: Adding SqlMembershipProvider Schema To A Database?

Aug 7, 2010

I'm currently creating a small web app that requires users to log in before accessing any features.

I'm using Visual Web Developer 2010 and I have created a database in the App_Data folder of my project that I now wish to add the required tables, views and stored procedures to in order to use the SqlMembershipProvider. I have ran the aspnet_regsql file and entered the required details and completed all the required steps; however, when I return to Visual Web Developer and refresh the database I created, nothing happens, there are no tables or stored procedures.

Although nothing has been added to the database in my project, when I open up SQL Server Management Studio, my database appears with all the relevant tables, views etc.

Is there any reason why the database with all the required tables etc appears in SQL Server Management Studio but not in my project in Visual Web Developer?

I'm getting rather confused as I have completed this before on another project on a different machine and it worked fine.

View 2 Replies

Security :: Delete The Member From The Aspnet_membership Table And Roles Related Tables Using Membership.DeleteUser

Mar 21, 2010

I've created a membership system based on asp.net 2. There are other tables that store user information, such as emails sent etc. I've created a users table based on the TableProfileProvider. My question is concerning deleting the member

Is it OK to delete the member from the aspnet_membership table and roles related tables using Membership.DeleteUser, though keep all the custom tables and the information including the information in the Users table created by the TableProfileProvider? or can you foresee problems?

View 1 Replies

Security :: SqlMembershipProvider ConnectionString Error When Try To Add New User To Database

Sep 8, 2010

I have a problem with SqlMembershipProvider. I have already created database aspnetdb. I need to add new user to database however one error occured. This is my web.config file:

[Code]....

and this is my application code:

[Code]....

the error occured in this statement:

[Code]....

View 1 Replies

.net - Use Custom SqlMembershipProvider To Store Users (and Roles) In Cache?

Feb 15, 2011

i'm developing a "small" warehouse-management WebApplication for few users(5-10 parralel) but with a complex authorization system(checking if pages,menus,TabPanels, UserControls and even single controls are visible or enabled) and permanent and frequent access. Because i've only limited experiences with the ASP.Net MembershipProvider, i'm unsure what's the best approach for following goal:

I want to hold all users, roles and frequently used masterdata in the Cache(in a Dataset). Hence every readonly access should be faster and causes less traffic than always using the database. On updates,deletes and inserts i would update the cached dataset and also the database.Can i use or extend the SqlMembershipProvider to achieve this goal and if possible how?Should i use the stored-procedures from asp.net or simply use the standard CreateUser, GetUser, DeleteUser-functionality? Does this approach makes sense at all?

View 1 Replies

Security :: Rename The Storedprocedure Names SqlMembershipProvider Class?

Nov 2, 2010

I understand SqlMembeshipProvider calls stored procedures with 'dbo' extension

View 6 Replies

Vb.net - Using The Membership.CreateUser Method?

Mar 17, 2011

I'm having issues using the membership.createuser method. My code is below, I get a null exception as runtime.

Dim username As String = userNameTxt.Text
Dim password As String = passwordTxt.Text
Dim email As String = emailTxt.Text
Dim status As New MembershipCreateStatus
Dim blank As String = ""
Dim provider As MembershipProvider
Dim providerUserKey As New System.Object
Dim user As MembershipUser
user = provider.CreateUser(username, password, email, blank, blank, True, providerUserKey, status)

View 3 Replies

C# - Overriding SQLMembershipProvider / Adding Few Extra Methods To Deal With The Roles By Using LINQ?

May 27, 2010

Is there built in methods into .net framework to do the following:

Get role GUID from user name/user GUID
Get role name from role GUID

So far I have been sending queries to the asp_roles and asp_users tables to obtain that information and I'm wondering if there is a nicer way of doing this?

I have the following methods that I store in the ASPUtilities class:

getRoleGUID(guid userGuid) { LINQ joins }

getRoleGuid(string userName) { LINQ joins }

getRoleName(guid roleGuid) { LINQ joins }

EDIT:

I have just looked into extending SQLMembershipProvider examples.

Few examples completely override the SQLMembershipProvider, but I think what I'm interested is just adding few extra methods to deal with the roles by using LINQ. Is this feasible?

View 1 Replies

Security :: Membership.CreateUser Without Password?

Feb 7, 2011

Is there possibility to create new user with Membership.CreateUser but not to specify the user's password?

I tried with minRequiredPasswordLength="0" minRequiredNonalphanumericCharacters="0", but it didn't work.

I also tried with "" and DBNull.Value for password in the function but it didn't work.

Is there a way to do this?

View 8 Replies

Web Forms :: Calling The CreateUser Process From Within Another Sub?

Nov 14, 2010

How do I call the CreateUser process (as if the user click on the Create User button) from another sub within my code that will receive the call to action ( I am hiding the Create User button and adding my own button to do so other processing, but how do I call the call the Create User process that is part of the CreateUserWizard control from within another sub..

View 3 Replies

How Database & Tables Can Create Using Createuser Control

May 24, 2010

How do database and tables get created when I am pressing create user wizard in asp.net?

View 1 Replies

How To Create Users In A Membership Table Without Using CreateUser

Jun 2, 2010

I want to migrate users and posts from an existing forum I am using to a ASP.NET membership table without using CreateUser. Basically I want to maintain userIDs so that when I migrate posts they continue to associate with the correct users. Is there a way to do this or would I be better off just using CreateUser and then finding a way to re-assign the post-by-UserIDs to the correct new IDs?

View 3 Replies

Security :: CreateUser Adding 2 Rows To Aspnet_Users?

Aug 10, 2010

I'm working with 2 sites (Intranet and Extranet) that share the same .net membership database (the standard out of the box version). The Intranet and Extranet site users are stored in separate "Applications" within the membership database. I create all users for both sites from within the intranet site. Everything seems to be working except that when i create a user for the extranet site I end up with 2 rows for that user in aspnet_users. One with userID (guid) that I send in and another with a different guid. I'm assusming that .net is creating an anonymous user. The intranet membership provider is the default.

I could delete this row through sql but am hoping for a more elegant solution. Any suggestions?

Dim objUser As MembershipUser

View 6 Replies

Security :: CreateUser Results In Login Failed?

Sep 23, 2010

I am using the Membership class in System.web.security to create a bunch of users. Here is the relavent code

[Code]....

After running the above code the out parameter status says success. I take the userId (email address) as well as the password generated by Membership.GeneratePassword to attempt to login to my app, I get Login failed. What am I doing wrong?Note: I can use the ASP.Net configuration tool to generate a user and that user successfully logs in. I checked the table Application in the database to see if the application these users I am attemtping to register in code were being registered to a different application than the one I an running but there is only one application in that table.

View 1 Replies

Custom CreateUser Method With Additional Parameters - Store In The Db

Mar 5, 2010

i have implemented custom MembershipProvider and now i would like to use CreateUserWizard to create new users.. the problem is that i want to store in the db more information that normally (e.g. first and last name). There is function:

public override MembershipUser CreateUser(string username, string password, string email,
string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey,
out MembershipCreateStatus status)
{
throw new NotImplementedException();
}

which i can implement but it won't store first name etc. i found here: [URL] solution that i can overload this function and call it manually but the default CreateUser function will still be called in this case...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved