Exception Details: System.Data.SqlServerCe.SqlCeException: The column name is not valid. [ Node name (if any) = ,Column name = PasswordFailuresSinceLastSucess ]
After login to what? Have you run the membership initialisation code?
In the root folder of your website, open the _AppStart.cshtml file, which is a special file that is used to contain global settings. It contains some statements that are commented out using the // characters:
<div> </div> <div>
@{
</div>
<div>
WebSecurity.InitializeDatabaseConnection(
"StarterSite"
,
"UserProfile"
,
"UserId"
,
</div>
<div>
"Email"
,
true
);
</div>
Have you checked your database to see if it has a webpages_Membership table with a column called "PasswordFailuresSinceLastSucess"?
(Yucky typo in "Success", but that's hardcoded for now - expect that to change in the RTM....)
Problem was that with WebMatrix beta 2 we get new SQL Server Compact Edition CTP2, with which database recreation didn't work.
Fortunately on Microsoft download sites we still could download SQL CE CTP1 which works well with WebMatrix beta 2, so my application isn't all broken. I really hope, that next time we won't get so much trouble (I'm not the only one to have this problems
with new Sql server compact edition CTP 2) when moving on to next release.
Actually, I think that the problem was that the schema for the membership database tables has been changed, but that your Entity Framework approach didn't know that. WebMatrix is not intended to be used with the EF.
With previous Sql Server CE database gets refreshed and works with new membership schema, but with new one it doesn't work correctly and doesn't refresh/rebuild database when I make changes in data model classes.
So yeah, login problem was because I didn't get new table for membership, so I marked your post as an answer. Problem was in new SQL Server Compact Edition which ships with WebMatrix beta 2. And other guys also have problems when using new SQL CE...and I
hope they'll correct or document this bugs.
If it works with previous version, it also should with new one I think...I guess?
zigomir
Member
38 Points
35 Posts
Beta 2 - login problem
Oct 11, 2010 01:29 PM|LINK
At login I get this message:
And even on this site I can't find any sample of login code: http://www.asp.net/webmatrix/tutorials/16-adding-security-and-membership
After installing Beta 2 I only have problems for now :)
Thanks
login Beta 2
Mikesdotnett...
All-Star
154955 Points
19872 Posts
Moderator
MVP
Re: Beta 2 - login problem
Oct 11, 2010 08:27 PM|LINK
After login to what? Have you run the membership initialisation code?
Have you checked your database to see if it has a webpages_Membership table with a column called "PasswordFailuresSinceLastSucess"?
(Yucky typo in "Success", but that's hardcoded for now - expect that to change in the RTM....)
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
zigomir
Member
38 Points
35 Posts
Re: Beta 2 - login problem
Oct 12, 2010 05:37 AM|LINK
In I have _AppStart.cshtml this line:
WebSecurity.InitializeDatabaseConnection("DataContext", "Users", "UserId", "Email", true);I didn't change anything from beta 1 except _start to _AppStart (Mail and LayoutPage of course), but in beta 1 login worked.
webpages_Membership table doesn't include PasswordFailureSinceLastSuccess. It should include it by now, right?
In beta 1 database file was re-builded when I was changing the database model (I'm using code-first Entity Framework principle),
but now it seems like db.Database.SetInitializer<DataContext>(new db.RecreateDatabaseIfModelChanges<DataContext>());
isn't working any more. :/
Do we except to have even bigger changes for RTM release?
I've also noticed that WebSecurity.IsCurrentUserInRole("admin") was changed to Roles.IsUserInRole("admin") but this was
documented only on offical webmatrix tutorial page.
It would be nice from Microsoft for documenting all the changes in one place...but your blog also helped me, so thank you.
zigomir
Member
38 Points
35 Posts
Re: Beta 2 - login problem
Oct 12, 2010 10:42 AM|LINK
Problem was that with WebMatrix beta 2 we get new SQL Server Compact Edition CTP2, with which database recreation didn't work.
Fortunately on Microsoft download sites we still could download SQL CE CTP1 which works well with WebMatrix beta 2, so my application isn't all broken. I really hope, that next time we won't get so much trouble (I'm not the only one to have this problems with new Sql server compact edition CTP 2) when moving on to next release.
Thanks anyway!
Mikesdotnett...
All-Star
154955 Points
19872 Posts
Moderator
MVP
Re: Beta 2 - login problem
Oct 12, 2010 11:48 AM|LINK
Actually, I think that the problem was that the schema for the membership database tables has been changed, but that your Entity Framework approach didn't know that. WebMatrix is not intended to be used with the EF.
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
zigomir
Member
38 Points
35 Posts
Re: Beta 2 - login problem
Oct 12, 2010 01:23 PM|LINK
With previous Sql Server CE database gets refreshed and works with new membership schema, but with new one it doesn't work correctly and doesn't refresh/rebuild database when I make changes in data model classes.
So yeah, login problem was because I didn't get new table for membership, so I marked your post as an answer. Problem was in new SQL Server Compact Edition which ships with WebMatrix beta 2. And other guys also have problems when using new SQL CE...and I hope they'll correct or document this bugs.
If it works with previous version, it also should with new one I think...I guess?