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  on Jul 08 2013

Here is a small update about the most recent checkin for sBlog.Net. Now there is no need to keep track of what scripts were ran manually. Let me elaborate! Until yesterday, in order to setup sBlog.Net you will first have to run the Init.sql file, then the sblog_02_01.sql and sblog_02_02.sql and so on. Not any more!

When you get the master branch, restart the application (saving web.config or recycle application pool) and now you will be looking at the following screen: This is true whether you are upgrading from an older version of sBlog.Net or a new installation. Once you fully complete the installation, you won't be looking at this screen anymore!




However, if this is a fresh installation and you have any issues with the connection string, you will see the following screen (as before)!



Once you update the connection string or fix the authentication issues, you will be back to the database preparation screen shown in the first screenshot. Now when you enter the connection string and click on "Install Now" button, the database will be updated and depending on the scenario, you will either be sent to the blog setup screen (fresh install) or the home page (upgrade from old version of sBlog.Net). That's it you are all set! The scripts are picked from the Sql directory within the sBlog.Net project or your IIS application! If you wish to add a new script you can do so following the numbering convention used there (a new post follows with some details).

Let us assume for the sake of this post that you have added a new script called sc020004.sql. This would be indicated when you login to the administration section as shown below:



When you click on the link provided in the notice, you will see the following page!



Once you enter the connection string to verify ownership, you will be able to update and post login you wont see this notice anymore!

Check it out and let me know your thoughts! Have fun :)

Happy coding!

Posted by admin under General  sBlog.Net  on May 08 2013

Hello!

I recently checked in new functionality in to the master branch of sBlog.Net. They are:

  • Role based access - By default "1" user belongs to the "Super admin" role. All other users will be under the "Author" role.
  • Author listing page and posts by author
  • Disqus support - Go to the settings page to play with it
I have recently started using bootstrap for a number of my projects (day job & personal projects) including the official site for sBlog.Net. So I was thinking of using the same for the administrative section of sBlog.Net! However, I am treading carefully, since I also have to update jQuery! So this could be expected soon! Watch out! 

Tagged sblog.net 
Posted by admin under General  sBlog.Net  MySQL  on May 01 2013

Hello Folks!

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!

Tagged sblog.net  c#  mysql 

<< Previous Page
Next Page >>