I received a few emails about the ability to use sBlog.Net with MySQL as the backend and so I jumped in to that missed. I was able to successfully modify the project to use MySQL! I created a branch off of the master branch in github! Check it out here !
On the MySQL side, go to the sBlog.Net.DB\v1.0\Install folder where you will find a Init.sql file. I use phpMyAdmin for working with MySQL. You could do the same and use the import functionality to create a new database using this .sql file! Now, you can fire up Visual Studio, open the project downloaded, update the connection string, thats it! You are all set!
Have fun and let me know your comments!
I am back to developing sBlog.Net! It's been a while since I got a chance to work in this project! I have added disqus support to sBlog.Net :) You don't have to go with the native commenting system anymore! Fun, isn't it ? This change only went in to the master branch. You can get it from github here!
First step to use disqus is to get the latest source. Then run the sBlog.Net.DB\v2.0\Update\sblog_02_01.sql on your sBlog.Net database. Now login as the administrator and go to the Settings page. Here you will have the ability to enable the disqus commenting system. Just register with the disqus site by specifying your site name since you need the disqus shortname to finalize the process of enabling the disqus commenting system for your site!
Have fun and happy coding :)
I finally decided to branch sBlog.Net so that I could work on some improvments to the project! I will probably start working on the next version soon. But it is not going to be a major relase most probably! I will keep you all updated!
Here is the github url for the release - github branch
This short article discusses about modifying the default hashing method to something you wish. By default, the downloaded project uses MD5 hashing, and it is strongly recommended to modify this something more safer. Here are the steps to do this:
- The web.config appSettings section has a key called hasher. This key is used by the blog engine to identify the type of hashing used to store the passwords. This value has to be modified to change the hashing mechanism
- In order to change this, first you need to create a new hasher that implements the IHasher interface.
- A sample can be found in the sBlog.Net.Domain project, under the Hashers folder.
- Now, create a new class file, say ShaHasher within the same folder. Implement the IHasher interface, which has a single method HashString
- Implement your hashing method within the HashString stub.
- Finally, open your web.config and modify the value of the "hasher" key to the fully qualified type name of the new hasher you created
- That's it, any password related activity would now use the new hashing method
- PasswordHelper - This class decides how a password is hahsed. You can also modify this to make your hashing more customized to your needs.
Note that, you CANNOT modify the hasher after you have started using the blog by completing the initial setup, creating the admin user (and possibly other authors).
The current build of sBlog.Net is optimized for shared hosting. This is because of the following reason: UserIdnetity is one of the classes that is part of the core web framework. It has to be serializable, so as to support the object being able to be stored in the context for a user. In order to make the object safe to be serialized, UserIdentity class implements the ISerializable interface, and implements the GetObjectData method. Also, if you notice, this method is marked with the SecurityCritical attribute.
In order to support this method in a shared hosting environment, the following line is added to AssemblyInfo.cs file in the sBlog.Net project.
Without this line, you will get the following exception:
Inheritance security rules violated while overriding member: 'sBlog.Net.Models.UserIdentity.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.Thus, in order to avoid the exception above, the code snippet above is added to the AssemblyInfo.cs. In a non-shared environment or when you are running locally, this won't be needed. Leaving this in-tact won't affect either.
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.TypeLoadException: Inheritance security rules violated while overriding member: 'sBlog.Net.Models.UserIdentity.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
Bin-Deployed MVC 3:
Some shared hosting providers do not install MVC 3 in their GAC by default, this is due to the fact that multiple versions of MVC in the GAC can create conflicts. In that case, you will have to bin-deploy the required assemblies to run MVC 3. Refer to the following posts:
- BIN Deploying ASP.NET MVC 3 with Razor to a Windows Server without MVC installed
- Bin Deploying ASP.NET MVC