Jump to content

adding WebSecurity Object

Recommended Posts

I followed the whole tutorial here http://www.w3schools.com/website/webpages_demo.asp and have all the files in my WebMatrix Demo website project as instructed. I set up a "Northwind.sdf" database and created a table "Users" (having Id, CompanyName,City, Country columns) but my website could not run.

Connection string "Users" was not found, is the issue.

Line 2: WebSecurity.InitializeDatabaseConnection("Users", "UserProfile", "UserId", "Email", true); This line is highlighted in red. I don't know how to fix it. I read somewhere about "public static class WebSecurity" but I don't know where to put it, which file and which line (right place for it if inserting it can solve the issue).

When I delete _AppStart.cshtml, and by hitting Run button in WebMatrix for testing, my Demo Website can run but Pages like Register, getCustomers, Customers are missing the database. Please help me to set up things properly in order to solve the problem. Im new to this.

Thank you very much. Allen.

Link to post
Share on other sites

The error message makes it sounds like it is expecting a database connection string called "Users", and it can't find one. Look into creating a database connection string. If it was a problem with WebSecurity not being included, the error message would indicate that.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...