Unable To add membership authentication to website

80 views Asked by At

I created a website named xmlquiz. I want to authenticate it with membership, but when I am going to security tab(Website->ASP.Net Configuration->security) I am getting an error as follows.

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 help in diagnosing the problem: Unable to connect to SQL Server database.

I am trying following code in web.config

<rolemember enable="true"> and run ASPNET_REGSQL.exe but it does not work.

Thank You.

1

There are 1 answers

4
Sawyer On

I find another post with the same problem of yours,

how to enable role in asp.net?

I hope to see your web.config (please check it with the link above) and could you find the database files in AppData Folder(I think)

if I understand correctly, questionid should come from xml base and userid could be get by the current user logged in. With the code below:

MembershipUser user = Membership.GetUser(); 
Guid userId = (Guid)(user.ProviderUserKey);

to get the userId.

I don't know your xml schema so I can't tell you how to get questionId and correct result.