Security :: Getting Sqlserver Error 40 With "roles.AddUserToRole"?
Sep 2, 2010
I am using Membership in my asp.net website built using VS-2005.
I am able to create a new user using them Membership.CreateUser method or from asp.net Website Configuration but when I run "roles.AddUserToRole" from code-behind or create a new role using ASP.NET WebsiteConfiguration I am getting the following error (in asp.net website configuration).
There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.
The following message may in diagnosing the problem:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
I have followed these steps:-
1>Enabled forms authentication in web.config by using <authentication> and <authorization> tags and verified the same set main.html as start page and set frmlogin.aspx as loginurl and upon running the website the user was getting redirected to frmlogin.aspx
2>removed localsqlserver from connectionstrings and again added a custom connectionstring by name LocalSqlServer to override the LocalSqlServer in Machin.config so that the "AspnetSqlMembershipProvider" uses a custom database and not aspnetdb.
3>using aspnet_regsql.exe tool created the membership tables for my database
4>After I started receiving the error checked SqlServer-2005 SurfaceArea Configuration and found that under RemoteConnections, settings were already made to allow 'Remote and Local connections' as well as 'allow TCP/IP and Named Pipes'.
5>Then opened SqlServer Configuration Tool . Here I found that MSSQLServer was started and running. But SQLServerAgent was stopped so started it and set its startup type to automatic. Then stopped SqlServerService Manager and restarted for the settings to take effect and found that the SQLServer Agent was stopped and I have to manually restart it. Will this be the cause of this error?
View 2 Replies
Similar Messages:
Jan 2, 2011
I'm trying programatically to create a new user, that's working OK on it own, but whenever I add the following line to my code, it seems to create two new members with the same name in my aspnet_Users table?
Roles.AddUserToRole(newUser.ToString(), "Registered");
Here's my code:
[Code]....
View 6 Replies
Feb 8, 2010
Do you know where could come from my issue. In deed every time i create an user "customers" I always have to active it in asp.net configuration.
View 2 Replies
Mar 5, 2010
I want to create a user wizard from which the user can choose the roles during the registration procedure..
For this i followed a video tutorial and wrote the following code
<script runat="server">
Public Sub ActivateStep(ByVal sender As Object, ByVal e As System.EventArgs)
ListBox1.DataSource = Roles.GetAllRoles()
ListBox1.DataBind()
End Sub
[Code]....
This is the code i used.
When i run this.. It runned well...
But
-- it doesn's showed the complete wizard step..
-- it created the user with the provided user name
-- the user was not assigned with the role specified.
View 3 Replies
Apr 11, 2010
i'm using visualsudio2005 c#and this is my config file that in the member folder :
[Code]....
and i gave my user the role .... and when i sign in as a member role user and try to access a page in this folder it gives me Error 404 ...
View 4 Replies
Mar 7, 2011
I have a multi level application that I am developing and need to block multiple rows from being joined. I know how to hide one role but I cannot figure out how to hide multiple.
Here is my current code
[Code]....
View 2 Replies
May 17, 2010
Newb question: what is the standard practice for assigning roles to newly signed-on members. Is it usually manual or is there a way of automatically assigning roles. Being completely new to this, I am confronted by the issue of my site having three different roles that new members could fall into, but am unsure about how to assign each a role. I can't imagine having to go through the process manually if I have thousands of members.
View 6 Replies
Apr 24, 2010
[ASP.NET 3.5, FormsAuthentication, SQL Server]
In the Roles table there is Role, and RoleType.
I have 3different roles, 2 of which have sub-roles.
Example
Role----------------------Type
Adminstrator
Subscriber---Basic
Subscriber---Business
I need to implement Code Access Security, and URL based security using the roles & types...
For instance, the (Subscriber/Basic) would need to view a different set of pages, and have different access to things then a (Subscriber/Business).
I think I can handle the Code Access security with a custom attribute, but I am unsure to how enforce a User be apart of 2 roles in the URL Authorization.
I am currently using the web.config to deny/allow access to the directories/pages.
e.g.
/Areas/Admin/web.config
[Code]....
Is it possible to force the user to be apart of 2 roles with this technique?
View 1 Replies
Mar 14, 2011
im usin visual studio 2010 and sql server enterprise edition 2005..
when my database is mapped to visual studio this table "Contract" contain a field "ContractAmount" tht is "real".. while the conversion is done the field is mapped as "single" in Edm which is makin me a lot of problems.. i tried to change the type to "Double" and then im havin the error below:
Error 2019: Member Mapping specified is not valid. The type 'Edm.Double[Nullable=True,DefaultValue=]' of member 'ContractAmount' in type 'Website_DBModel.ContractAEG' is not compatible with 'SqlServer.real[Nullable=True,DefaultValue=]' of member 'ContractAmount' in type Website_DBModel.Store.Contract'.
View 2 Replies
Dec 2, 2010
I have a SQL Server 2000 database. I am trying to ssetup a sqldatasource in Visual Web Developer 2008 Express. I get an error saying "Microsoft.SqlServer.Management.Sdk.Sfc cannot be loaded". Everything I can find says this is related to 2005 or 2008. Any ideas what I can look for?
View 2 Replies
Mar 25, 2011
i created a asp.net form for registration without using login controls and a table for storing information. the passwords in the password column in the table is clearly visible in text form i want it to be in encrypted form.
View 8 Replies
Jan 7, 2010
I have used .net login control to authenticate user,i have three types of role ,role1,role2 and role3 and i have users and user have different roles.
now my requirement is like as per loggedin user i want to redirect user on particular page as per role.
for example if loggedin user role is role1 than he will redirect default1.aspx
for example if loggedin user role is role2 than he will redirect default2.aspx
for example if loggedin user role is role3 than he will redirect default3.aspx
and one question if same user may be have more than one role than what should happen???
I got a solution for same than if we are used "loggingin" event than it would be possible but i had placed login control in login view anonymous template because as per my requirement i want that after successfull login user can't see login control on page.thats why i didn't get the login control event on code.
View 6 Replies
Mar 22, 2010
In our system now, we have a class of user and beneath each class, there's a type of user.
Is there a way to setup and use the ASP.Net role provider with this kind of setup?
View 2 Replies
Feb 20, 2010
i am new to asp.net, i am creating a small website for my college, in that.
Only the admin's can create other users...
Now while using the nw registration wizard, i hav to mention the role also in that page.
View 5 Replies
Jun 10, 2010
can any one tell how to create the roles in asp.net? when ever Admin creates the roles, there it self he should assing the pages,which pages should be open when ever perticular person enters in to the site. When ever Admin wants to assing the Roles,all pages appear in grid view with check box,if he checks that pages,he able to access other wise he couldnot access that page.
View 1 Replies
Aug 3, 2010
i want to create a webservice that reading from the user identity interacts with a db, where there are app names and group that can use that app, and gives to the user a list of operation that he can use.
My question is, is there any table in apsnetdb that does this association or i should create a costum table.
View 1 Replies
Mar 1, 2010
Pls explain the Membership Roles in MVC ASP.NET 3.5
View 1 Replies
Feb 27, 2011
I know how use Roles in Controller:
[Code]....
In this situation, any one who is not "admin" can'nt vist the "About.cshtml". But what if I want anonymous can see part of the "About.cshtml"?
[Code]....
I know code above is wrong, But how can implement my goal in Views
View 2 Replies
May 18, 2010
I have created 3 different folders (admin, user, viewer) in my site and each has a different template (masterPage). I created user and roles which are admins, users, and viewers. I assigned each role to a user in .Net administration Tool.
What I need to do is to allow each user to access his page only and deny access to others , except for the admin who can access all pages.
View 4 Replies
Oct 5, 2010
I'm trying to redirect users upon login based on their roles which were defined in the Administer website feature of asp.net.Heres what I'm trying protected void Login1_LoggedIn(object sender, EventArgs e)
View 2 Replies
Oct 7, 2010
Im trying to redirect different roles to different pages. Its working but the code I'm entering allows people through even with incorrect passwords. protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
View 1 Replies
Jan 11, 2010
Im now in assigning a roles to a user. But, 1 of my user wants me to assign 2 roles for him.. The situasion is like this :
I have a few roles which are :
- zone head
-zone officer
-clerk
The problem is now 1 person can be assign for 1 role only..
How can i assign 2 roles for 1 user..
View 4 Replies
Jul 2, 2010
I'm workin with Visual studio 2010 and I'm trying to create an ASP.net Web Site, language used - C#
I have 2 different pages, for 2 different users with 2 different roles.Each page has a textbox.I have already created them.What I want to do, is to make a bind between this 2 textboxes, so that the second to get the first boxes' text.I managed to do it, but only if the textboxes are on the same page, very easy (Textbox2.Text=TextBox1.Text) . But how to do it for 2 different pages, for 2 different users with 2 different roles?
Another trouble would be....How can I connect the both users same time....after i start debugging the project, I do a sign in but when I sign in with the second user,the first is automaticly siggned out and the text it's lost.Then, how can they synchronize and the second user see what the first one wrote,using that 2 textboxes? Wich is the solution?
View 4 Replies
Mar 10, 2010
I am currently having a spot of bother in something im trying to create. I want it so when a user who is in a certain role logs in they are directed to a certain page, and any other normal users are directed to another page.
I think i have this sorted via code but...
-The first time it will work, the 'admin' user will get directed to the appropriate page
-I then log out and log in as a normal user and get directed to the appropriate page
-then when i log out of that users account and back into the admin one i get directed to the normal users page instead.
-additional to this, I tried it on a different machine logging in as the admin user only to be redirected to the normal users page (is my session being stored somewhere?)
Ive traced through the problem and the user name and password being subbmitted are what they should be, yet it skips the true part of my IF statement for being in that role.
Here is my code I am using on the login form:
[Code]....
-When stepping through if seen it work and not work with the same values, I cant understand the logic of its inconsistency
the code i am using for the logout is (this is on my masterpage):
[Code]....
View 4 Replies
Jan 10, 2011
I have three roles:
AdminEditorGeneral
How can i give acces so to:
1- All users in roles Admin and Editor
2- Specific users from role General
i tried this but with no luck:
[Code]....
View 2 Replies