C# - Create User In Another Membership.ApplicationName?
Dec 6, 2010
I have an administration website - the users of which should be able to modify users for a public site. This means the administration site has a valid membership provider, but I want to be able to access/change members in another site (and therefore ApplicationName).
First thought was to set ApplicationName on the Membership static - but that seems like a bad idea according to answers here: Changing Membership.ApplicationName in code - thread safety.
Second thought was to duplicate the MembershipProvider entry to the web.config - so now I can do WebSiteMembershipProvider = Membership.Providers("WebsiteSqlMembershipProvider") - but I can't now seem to get to a 'Membership' object which will let me (for example) call the standard 'CreateUser' method.
I tried WebSiteMembershipProvider.CreateUser - but it takes a load more parameters, and doesn't seem to do anything if I poke some values into it.
Am I nearly there? Or do I need a different approach? There's always the SqlProvider's stored procedures, I suppose...
View 2 Replies
Similar Messages:
Mar 23, 2011
How to create ApplicationName and how to choose ApplicationName in C #?
Example:
I have several different applications into the same database. How to choose in combobox Application name" in nato dovolim prijavo. At present this can fix it in web.config, but I would like all done in c #.
View 7 Replies
Dec 5, 2010
On the MSDN page for the Membership.ApplicationName property (which applies to an asp.net membership provider), it warns that although one can change Membership.ApplicationName in code, 'The ApplicationName property is not thread safe for multiple writes, and changing the ApplicationName property value can result in unexpected behavior for multiple users of an application.' They therefore recommend avoiding using it for a 'web application'.
This is because the default SqlMembershipProvider is written as a singleton. But here's my question: is it OK if all the threads in my application process are going to set Membership.ApplicationName to the same thing?
I'm thinking of having multiple applications on my IIS box, each with their own separate application pool. I want to point them to the same location, but based on the hostname, set the application provider to different things. Wouldn't this actually be OK? It might not be a thread-safe operation, but doesn't each application pool have its own process and therefore its own instance of SqlMembershipProvider? So, every thread that tried to set Membership.ApplicationName for a given SqlMembershipProvider instance would be trying to set it to the same thing (the provider that is appropriate for that hostname).
View 1 Replies
Feb 9, 2010
I have a custom security module which is retrieving the applicationName of the defalut Membership Provider. I am using this value for convenience only. I mean, sometimes, I will authenticate the user as per "Windows Authentication" where there is no Login Form, and yet, I need to access the "applicationName" of the membership provider.So, in some of my applications, I am not using a memberhsip, and I leave it empty. And I found out that if the <membership> is not defined in web.config, it will default to "AspNetSqlMembershipProvider" type "System.web.Security.SqlMembershipProvider".I can add an key in <appSettings>, but I like to using the applicationName of the default membership provider, becuase in other applications I am using Forms Authentication, with a custom membership provider.If try to setup a dummy memberyship provider, I will get error that the connection string is empty.How I can set the "applicationName" property in web.config if I am using "Windows" authentication, and I have no membership provider ?
View 1 Replies
Jul 25, 2010
I am createing user dynamially with the below code; string MyPassword = Membership.GeneratePassword(8,0).ToString(); Membership.CreateUser(TextBox7.Text, MyPassword, TextBox8.Text); but before I start creating, I would like to check if the user name is used before or not.
View 2 Replies
Aug 31, 2010
i am using membership provider to create new user.
View 2 Replies
May 14, 2010
It's new to me to use the membership provider class.I was able to inherits the MembershipProvider in my library(HDIMembershipProvider.vb) and a lot of functions are generated. When I created the form to create a user like this:
[Code]....
Once the user clicks submit, how this function can be called ?
[Code]....
Each time I submit, the function is never called.
[Code]....
View 1 Replies
Sep 24, 2010
I have a CreateUserWizard that uses the membership provider and creates a user in a sql server database.I need to change the IsApproved property on creation to false.I know that it can be done by createing a custom navigation template... but then i will have to code all the checks for the creation of the user...Is there any other way to access that attribute?this is the aspx code:
[Code]....
View 2 Replies
Mar 16, 2010
I want to create the roles,membership and user data on ISeries AS 400 rather then the one used in APP_Data.
View 4 Replies
May 2, 2010
I have creatde a create user form which is build with asp.net 3.5 default membership module(C#).Now I want to integrate ajax validation in it, like bbc's registration form have.If anybody know any helpfull code, article, tutorial for this then please don't forget to share.
View 1 Replies
Aug 12, 2010
I have a custom membership user class and custom MembershipProvider working against database. Due to security reasons the user passwords are stored in the database as hashed values. So my procedure
public override bool ValidateUser(string username, string password) is
{
//select hashed password from db
return (EncodePassword(password) == dbpassword)
}
[code]....
View 4 Replies
Jan 7, 2010
Does anyone know how to disable a create user button in the Create User Wizard if the Terms and Conditions checkbox is not checked?
I have a CUW with additional fields (the data of which is stored in an additional table that I have added to the ordinaty SQL membership database) and I want the user to check the Terms and Conditions checkbox before the user is created.
By any chance, do you also know how to prevent the creation of the user if the additional fields have not been filled?
I triend with Java, code behind and many method but it still dont work: the user is created even if the Terms and Conditions are not checked.
View 6 Replies
Dec 20, 2010
why did asp.net team choose / as the default value of Membership Role application name rather than the project name that makes sense?
In addition, the application might not be deployed as the root application. It means that / is no longer
Edit 1:
For example: I create a project A first and deploy it. Later I create another project B and deploy it. If both projects use the default, they still work but it will be difficult to know which users come from each project.
For me, it is better if the default is set to the project name.
Edit 2:
I am talking about the applicationName attribute generated by Visual Studio in Web.config.
Why don't use the project name instead of / by default ?
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="ApplicationServices"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="ApplicationServices"
applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear />
<add name="AspNetSqlRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="ApplicationServices"
applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider"
type="System.Web.Security.WindowsTokenRoleProvider"
applicationName="/" />
</providers>
</roleManager>
EDIT 3:
After creating two applications (i.e., one as the root and the other one as the child app) and both have the same applicationName set to /, both application use the same ApplicationID. It means the slash has nothing to do with site domain tree. My confusion has been answered. So... why did Visual Studio set it to / (that makes confusion for me) by default?
EDIT 4:
I have two applications. One as the root application and the other one as the sub application under the former. Both use applicationName = "/". I got the result as follow in database: So what is the meaning of /? If no meaning, why did VS choose this confusing name rather than the project name?
EDIT 5:
From this article, I will make the summary:
If we remove applicationName attribute from web.config for both applications, the ApplicationName generated in database for the root will be "/" and the ApplicationName generated in database for the sub app will be "/subappvirtualdir".If we leave the applicationName to its default value of "/" for both applications, both root app and sub app will get the same ApplicatonName of "/" generated in database. If we change the applicationName to "any name you want" for both applications, the ApplicationName generated in database will be set to "any name you want" for both applications.
View 2 Replies
Mar 27, 2011
I want to separate the connection to the database in database.config So that I have web.config separate data with database.config.
View 1 Replies
Mar 11, 2011
I am currently writing a user management application which administers users in a single aspnetdb instance. This single instance contains multiple "applications" which all have roles assigned against the individual applications.
As each user can be a member of multiple applications I use Roles.ApplicationName to cycle through each configured application and then determine which roles they are a member of. After checking each application I set the Roles.ApplicationName back to the original application which is the management application.
The problem I am having is when multiple users eachview an individual application and a request for Roles.GetAllRoles() is made. Most of the time the roles that come back are for the intended application but sometimes the wrong application's roles come back due to other requests cycling over the Roles.ApplicationName per application.
I've since read that Roles.ApplicationName is not threadsafe and therefore should not be used in a web application but I would prefer to have a solution to this rather than having to rewrite the role model in the application.
Also, The aspnetdb applications are created via this administration system and therefore I cannot create multiple RoleProviders, one per application.
View 1 Replies
Mar 25, 2010
I have a (internet) web site with the below web.config (everything works fine). How would I alter this to include an applicationName attribute. I wish to eventually have multiple web sites using the same ASPNETDB database.
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<clear/>
<add name="LocalSQLServer" connectionString="Server=myserver.com; Database=MyDB; Uid=MyUser; Pwd=MyPassword; Trusted_Connection=False;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<customErrors mode="Off" defaultRedirect="~/Error.aspx"/>
<roleManager enabled="true"/>
<authentication mode="Forms"/>
<compilation debug="false"/>
<pages theme="Standard"/>
</system.web>
</configuration>
View 6 Replies
Jan 15, 2010
I have an asp.net page which I created using Visual Web Developer Express 2005, and locally everything works file as expected however when I uploaded the content of site into the online server one of the functionalities do not work and instead I get an error saying:
Server Error in '/Applicationname Application
Where the Applicationname above is replaced by them name of my application. It also state runtime error under the abve line.
And I am wondering if anyone could let me know what the problem is and how I could solve this issue.
For information I am using ASP.NET 2.0 and SQL Server 2005
View 3 Replies
Aug 31, 2010
May i know how i can change postion of Create user button in Create USer Wizard as i want to change according to requirement!
View 4 Replies
Sep 8, 2010
I am using a create User Wizard for registering a user and have converted it to a a template to capture additional information. In the CreatedUserEvent handler in Code Behind I am getting the UserName of the new user and their unique GUID key. This is then added to a seperate data table with addditional info captured from the user. The textboxes within the create user Wizard have validation controls. If the user has missed an entry these fire and it shops the process of creating the user.
BUT If I then complete the textboxes and then click submit it says the USER NAME already Exists! This is not what I want as the User just needs to correct the errors in the form and they should be able to keep their iniital User Name choice. Do I need to change the Event handler and if so am I still able to capture the USerName and Key so that I can add the data to the other non membership table.
View 2 Replies
Sep 2, 2010
I changed the 'applicationName' attribute of all the providers in the web.config file from its default value of "/" to an actual name "/sampleName" and I have also changed it in the aspnet_applications table in the asp.net database.
Now users cant login... Why?
I am trying to do this to 2 web applications I have inorder for them to share 1 asp.net database
What I have done wrong or omited?
View 1 Replies
Jun 9, 2010
im creating a multi step create user wizard for new members but I run into a problem. If the create of an account is in step 3 how do I capture the values from step 1 and 2. Should I try to pass the values to sessions or is there some other code. Here is some codebehind I tried so far (did not work).
[Code]....
[Code]....
View 1 Replies
Mar 4, 2011
probabaly a daft question but when creating a user using .net membership, can i exclude the username and just have the email as the 'username' like this?
Membership.CreateUser(model.UserName, model.Password, model.Email, ....
or leave blank...
Membership.CreateUser("", model.Password, model.Email, ......
View 2 Replies
Feb 26, 2011
Need to create a customized membership with database and web application in asp.net mvc.
View 1 Replies
Mar 24, 2011
[Code]....
How to change ApplicationName in C# or gobal.asax, or web2.config
View 1 Replies
Apr 25, 2010
i am developing a website in vb.net ,as i am having 3 urser,customer,admin,and employee
i have taken the loginpage and in the codebehind i have permission access to the customer,admin and employee,with different user names and password now my problem is how to make the page to recover the password if the user forget the username or password
View 3 Replies