Jump to content

adding WebSecurity Object


allentran
 Share

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 comment
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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...