Posted by admin under General  sBlog.Net  Disqus  sBlog.Net v2.0  on Feb 24 2013

To get started with this project, you need the following:

  • ASP.Net 4 Framework
  • Visual Studio 2010
  • ASP.Net MVC 3
  • MS SQL Server (or MS SQL Server Express)

Assuming, you satisfy the pre-requisites, follow the steps below to get started!

  • Download the sBlog.Net binaries zip file and extract the files.
  • Launch MS SQL server, create a new database for use by your blog - as an administrator or a user who has db_creator privileges. If the database was created by the user that is going to be used in the web.config file, skip the following steps to give db_owner access.
    • Then, if you don't already have a login, create a login
    • Now, you need to provide access to the newly created database for the user you created in the previous step
    • To do this, expand Security, then expand Logins, right click on the user your created, choose Properties
    • In the dialog that appears, choose User Mapping
    • In the right pane, select the database you created, check the checkbox corresponding to the new database
    • In the Database role membership section, choose db_owner, click on OK
  • Now (assuming your IIS directory is C:\inetpub\wwwroot), create a folder called sblog
  • Copy the contents of the folder extracted to the folder you created in the previous step
  • Now, right click on the "Uploads" folder, choose Properties. Then select the "Security" tab
  • Click on "Edit", if you do not find IIS_IUSRS add it. Then select the user, give "Full Control" for the Uploads folder, click on OK in the dialogs opened
  • Then, open the web.config file and modify the connection string to use the new database, user you created, copy this over since you require this while setting up the site!
  • Now open IIS manager, from the Start menu or by entering inetmgr in your Run dialog
  • Create a new website by right clicking on the Sites node and choosing Add Web Site
  • In the Add Web Site dialog,Now your website is all set to be used
    • Enter a site name
    • Select ASP.Net 4.0 application pool (or) create a new app pool that uses the ASP.Net 4.0 framework
    • In the Physical path text box, choose the folder (sblog), created in the previous step
    • Now select OK
  • In case you are using a website provider like godaddy, copy over the files using an ftp client of your choice.
  • To launch the web site, right click on it, choose "Manage Web Site" and then "Browse"
  • If you are using a provider like godaddy, go to the browser and enter your website address and follow the on-screen instructions.
Here is a blog post that might help you with the setup. In case you are hosting the blog using shared hosting, you may have to "bin-deploy" asp.net mvc 3 - refer to this blog post for more information!

For setup instructions using visual studio, click here! Now, you are all set to start using your instance of sBlog.Net!!

Tagged sblog.net  iis 
Posted by admin under General  sBlog.Net  on Feb 24 2013

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.

[assembly: SecurityRules(SecurityRuleSet.Level1)]


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.

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.
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.

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:

In the case of my provider, I will have to bin-deploy the following files:

If you prefer downloading them instead of finding them in your local machine, click here!

Tagged sblog.net 
Posted by admin under General  sBlog.Net  sBlog.Net v2.0  on Feb 24 2013

To get started with this project, you need the following:

  • ASP.Net 4 Framework
  • Visual Studio 2010
  • ASP.Net MVC 3
  • MS SQL Server (or MS SQL Server Express)

Assuming, you satisfy the pre-requisites, follow the steps below to get started!

  • Download the sBlog.Net sources and open it in Visual Studio
  • Launch MS SQL server, create a new database for use by your blog - as an administrator or a user who has db_creator privileges. If the database was created by the user that is going to be used in the web.config file, skip the following steps to give db_owner access.
    • Then, if you don't already have a login, create a login
    • Now, you need to provide access to the newly created database for the user you created in the previous step
    • To do this, expand Security, then expand Logins, right click on the user your created, choose Properties
    • In the dialog that appears, choose User Mapping
    • In the right pane, select the database you created, check the checkbox corresponding to the new database
    • In the Database role membership section, choose db_owner, click on OK
  • Go to visual studio, expand the sBlog.Net project, open the web.config file and modify the connection string to use the new database, user you created
  • Hit on Ctrl + F5, you will get to the setup screen. Just follow the on-screen instructions from now on!
For instructions on setting up sBlog.Net using IIS click here!

Hope this post helped you in getting started with sBlog.Net!

Posted by admin under General  sBlog.Net  Customizations  on Feb 24 2013

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).

Posted by admin under General  sBlog.Net  on Feb 24 2013

This post discusses a much more elaborate way by which you can create a custom designed theme, instead of using the themes provided by deault. This method will work either when using Visual Studio or IIS. The following are the steps to accomplish this:

  • Select the Themes folder
  • Right click on the Themes folder, select New Folder, enter a name for your theme
  • In this method, you have to create the layouts of your post, page and also the css
  • Now create 2 files: _Layout.cshtml and _LayoutPage.cshtml
  • Create a folder called css, add a file called style.css and add the styles you like
  • Refer to any of the default that has these 2 files, add the html to your new files similar to the ones present in the default themes
  • You can also copy/paste existing layout and modify them as per your needs
  • Just make sure you have all the sections, like the categories section, recent posts section etc!
  • Now, save the changes, build / publish your project and launch it
  • Login to the administration section as the administrator and go to the Settings section
  • Now, if you select the blog theme drop-down you will notice your new theme
  • Select your new theme and save the changes
  • You should now be able to see your theme being applied!

Congrats on creating your first theme using layout files!

Tagged sblog.net 

<< Previous Page