About Author

Justin Wendlandt
Justin Wendlandt
I work for Wells Fargo, play a lot of video games, and program in many languages. [ more ] E-mail me Send mail

View Justin Wendlandt's profile on LinkedIn

Calendar

<<  May 2008  >>
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar

Recent Posts

Recent Comments

Comment RSS

Stock Quotes

WFC 29.60 0.00 (0.00%)
NVDA 23.78 0.00 (0.00%)
MSFT 30.4501 0.00 (0.00%)
HAS 37.19 0.00 (0.00%)

Xbox Gamer Card

Jwendl
Jwendl
Gamer Score: 4525
DYNASTY WARRIORS 6 (220) GTA IV (80) Culdcept SAGA (25) Rock Band (270) Overlord (420) Assassin's Creed (490) DEAD RISING (440) Halo 3 (535) Guitar Hero II (90) Oblivion (390) Blue Dragon (25) Eternal Sonata (30) Tony Hawk's Project 8 (135) Gears of War (470) Crackdown (405) CSI-Hard Evidence (0)
Offline
2008-05-15T00:37:59-05:00
Last seen 15 hours ago playing DYNASTY WARRIORS 6

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Creative Commons License

Header Photo

Convert BlogEngine to use Asp.NET Membership Provider

January 4, 2008 01:08 by jwendl

This BlogEngine instance uses the Asp.NET Membership Provider, and it was actually quite easy to convert. Big kudos to the team who has worked on this Blog software.

Comment out this code inside Web.config

Replace it with this code

Then you have to install the ASP.NET Membership SQL Registration program. Best described at this URL http://aspnet.4guysfromrolla.com/articles/040506-1.aspx

This was almost all you need to do to finish the conversion. The problem is that you need to now setup a default user of some sort. This can be easy, or hard depending on how the WSAT installed your instance. Please read up on ASP.NET membership before you attempt to convert over. I had to manually set the roles up on the proper application and user inside the aspnet_UsersInRoles table. After that, login with the default user and everything works just fine.

The reason why this works is because the XmlMembershipProvider class inherits the MembershipProvider class that ASP.NET provides. This means that all of the functions that BlogEngine uses for authentication are extensible to any custom membership provider that you can dream of.

Plain text can be downloaded from the attachment.

aspnetmembership.txt (1.41 kb)


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Related posts

Comments

January 26. 2008 00:23

Scot


When I try what you provided above this is what I get can you help in telling me what I am doing wrong?


EXECUTE permission denied on object 'aspnet_CheckSchemaVersion', database 'blog', schema 'dbo'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: EXECUTE permission denied on object 'aspnet_CheckSchemaVersion', database 'blog', schema 'dbo'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): EXECUTE permission denied on object 'aspnet_CheckSchemaVersion', database 'blog', schema 'dbo'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +862234
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +739110
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1956
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +149
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +903
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +415
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135
System.Web.Util.SecUtility.CheckSchemaVersion(ProviderBase provider, SqlConnection connection, String[] features, String version, Int32& schemaVersionCheck) +367
System.Web.Security.SqlMembershipProvider.CheckSchemaVersion(SqlConnection connection) +85
System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +1121
System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105
System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42
System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +83
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160
System.Web.UI.WebControls.Login.AttemptLogin() +105
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102


Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832

Scot us

January 30. 2008 17:40

jwendl

Scot,

It appears that one of two things aren't working out in yours environment. Maybe you can try to re-run the aspnet_regsql.exe file again to get the permissions setup properly, but if that doesn't work it might be because of the username setup for the database tables.

What do you use for your NETWORK_SERVICE user account? If it's left at the default of NETWORK_SERVICE or IUSR_<MACHINE NAME> then you might have to give it permissions to that table.

-- Add user to database role
USE aspnetdb
GO
sp_addrolemember 'aspnet_Membership_FullAccess', '<User Name>'

Unfortunately the ASPNET Membership stuff uses EXECUTE statements when you login or create a user. So you might have to play around with permissions a little bit on the user that has access to the database.

jwendl us

May 8. 2008 10:17

Andre Tagesgeld

Ah - that´s a nice idea. Didn´t expect it to be this easy.

Andre Tagesgeld de

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading