Wednesday, November 18, 2009

Installing Sitefinity on Shared Hosting with Medium Trust

My recent project required use of CMS, after researching i zeroed down on Sitefinity. I have been a fan of Telerik components so i decided to go with Sitefinity as they have all the features i needed and their support is fantastic.
For Sitefinity to work with its full functionality you need to host it with Full trust, but i decided to host it on a shared hosting for saving on cost and reliability of my host. I hosted with HostingGuru.com.

Here are the steps to deploy Sitefinity to your shared hosting with medium trust.
In medium trust you cannot use HealthMonitoring and Workflow. Depending on your host provider there could be issues related to RadUpload - uploading of files, uploading of zip, RadProgressArea should be also disabled.
Before setting the trust level to medium, make sure you modify the application web.config file as
described below:

1. Disable page and module workflow *:

allowPageHistory="false"
allowPageWorkflow="false" name="Sitefinity"
type="Telerik.Cms.Data.DefaultProvider, Telerik.Cms.Data" />



securityProviderName="" allowLocalization="False"
allowVersioning="True" allowWorkflow="false



securityProviderName="" allowLocalization="true"
allowWorkflow="false"



applicationName="/Blogs" allowVersioning="True"
allowLocalization="False" localizationProviderName=""
allowWorkflow="false"


2. Disable health monitoring:



3. Make sure the following lines are commented out:



4.The Sitefinity module providers cannot get their database objects created in medium trust environment and you may get errors.
To prevent this, you need to enforce database upgrade in full trust environment,
in your local Web site. Creating at least one content item in each module before uploading the upgraded
database to the production server and setting the trust level to medium will initialize all modules in the
database. The Sitefinity Search service does not work in medium trust environment.

RadMemoryOptimization requires ReflectionPermission in order to operate correctly. This means that
in normal circumstances you will have to run your application with Full Trust permissions set, unless
you create a custom security policy, which allows ReflectionPermission. If you are unable to set Full
Trust or custom security policy, the solution is to put the Prometheus controls assembly in GAC.

The Upload Control functionality is not available in medium trust environment. You need to upload the
controls manually through the application web.config file.The upload of .ZIP files in the Images & Documents module is currently not possible in medium trust environment.

5. Now copy all your files to your host

6. Give App_Data read and write permissions for ASP.Net/Network Service.

7. You can ask your host to attach the database to Sql Server, and you can then change the connection string . web.config file.

8. Log on to the Administration control and Select Administration Tab -> Services
Select Search and select "Start Indexing" on the right pane. This will index your website and now you can use the search engine.

Hope this helps, here is the sample website i have deployed http://www.planetfireworks.com/





Friday, November 13, 2009

Moving from one hosting provider to a new one

Moving from one hosting provider can be a headache for novice users, who are not aware of how to update name servers.
Follow these steps and you will save yourself some frustration:
1) Find a hosting provider after doing some good research, don't jump on the cheap bandwagon. Do some research, view feedbacks from other users. The most important thing for any hosting provider is their customer service, so make sure your hosting provider has a online chat, phone number to get in touch during emergency.
2) Once zeroed down on your new hosting provider, sign up for an account.
3) You will receive the new name servers such as ns1.yourhostingcompany.com and ns2.yourhostingcompany.com along with the IP's.
4) Before you update the name servers with your domain registrar, make sure you download your emails and webfiles from your current hosting account.
5) Login to the control panel of your domain registrar, this is where you have registered your domain name. Don't confuse this with your hosting account.
6) Go to the namserver section in your control panel and replace the old entries with the new name servers.
7) Save the settings, usually it takes few hours to update the DNS servers around the world, but max can be12 -48 hours for the DNS around the world to refresh.
8) Check your website every few hours, once you can see your new server, you can stop your account with your old hosting provider.


Any questions just post it!

Wednesday, September 2, 2009

Retrieving the id of last inserted record - PostgreSQL

PostgreSQL 8.3

To get the id of the inserted record we make use of the new function "returning" along with "nextval".

Syntax:
Dim NextRecord as integer

Dim cmd As Odbc.OdbcCommand = New OdbcCommand ("INSERT INTO mytable (myid, column1, column2) VALUES (nextval('mytable_myid_seq'), ?,?)
RETURNING myid;")


cmd.Parameters.Add(New OdbcParameter("@column1", column1value))
cmd.Parameters.Add(New OdbcParameter("@column2", column2value))

NextRecord = cmd.ExecuteScalar

Explanation:
myid is the auto increment column in the table.
nextval retrives the number which will be generated
returning returns the new myid.

Note: if your column names or sequence have capitals then do add double quotes
example: ""ColumnNames""


Enjoy~

Mehdi

Thursday, August 6, 2009

PostgreSQL and .NET

Recently my .NET project required me to use PostgreSql as the database server.
The steps to connect to PostgreSQL from .NET are as follows
  1. Download the odbc driver from http://www.postgresql.org/ftp/odbc/versions/msi/
  2. Run the installer

Connection string:

Dim hostname As String = "localhost"
Dim port As String = "5432"
Dim user As String = "myuser"
Dim pass As String = "mypass"
Dim db As String = "myDB"
Dim connstr As String = Nothing


connstr = "DRIVER={PostgreSQL ANSI};SERVER=" + hostname + ";UID=" + myuser + ";PWD=" + mypass + ";DATABASE=" + db

Dim DB_connection As Odbc.OdbcConnection = Nothing

DB_Connection = New OdbcConnection(connstr)

'Open the connection
DB_Connection.Open()


Enjoy~

Mehdi

Wednesday, May 27, 2009

Missing desktop icons or missing icon pictures


I was facing issues with missing desktop icons or missing icon pictures on my windows vista system, after gooogling and trying few suggestions posted i was not able to get my icons back. 
It was annoying to see most of my icons replaced by an blank picture.
So i tried the most simple thing
right click on the desktop -> Select Preferences -> select Change desktop icons on the Desktop Icons Settings window which just popped up, press the Restore Default button. click OK. Presto! your icons appear again.

Hope this helps! 

Mehdi