Thursday, April 2, 2009

Generating user instances in SQL server is disabled use sp_configure user instances enabled to generate user instance.

User instances are useful for users who are running Windows under a least-privilege user account (LUA) because each user has SQL Server system administrator (sysadmin) privileges over the instance running on her computer without needing to run as a Windows administrator as well.

To enable user instances, do as follows

1. Open the SQL Server Management Studio Express.
2. In the query editor type this text: exec sp_configure 'user instances enabled', 1.
Then type: Reconfigure.
3. Then restart the SQL Server database.

For more info, go to

http://tarriniluca.spaces.live.com/blog/cns!EC6B91E5AAED519B!728.entry

Thursday, March 26, 2009

Ajax Calendar display problem

The Ajax calendar might display something like this



This problem is due to padding in the css file.

To set this right, you can append


div.ajax__calendar_days table tr td
{
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
padding-top: 0px;
}


to the css file.

The calendar now looks like this

Saturday, March 21, 2009

How to set script url`s relative to the website in masterpage

Prepending "~" to the URL says that the URL must be website relative. But this works only for css files, not for scripts. One solution is to use a form with runat="server" and place a script manager as follows

Failed to access IIS metabase problem

ErrorDetails: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase

Cause:
When you install IIS AFTER .NET 2.0 framework, the rights of the ASPNET user had not been set correctly.

Reset the IIS Registry settings by running the command "C:/Windows/Microsoft .Net/Framework/V2.0xxx/aspnet_regiis -i"

Thursday, March 12, 2009

Add View Dialog in Asp.NET MVC not showing View Content option or create a partial view

When creating a strongly typed view in the Asp.NET MVC application, if the add view doesnot look like this




Its the problem of the MVC framework version. i.e. you may be using a beta version. To solve the problem install Asp.net MVC RC1.

Wednesday, February 25, 2009

Deploy a ASP.Net MVC Application on IIS 5.1(Windows Xp)

Some of the problems encountered during deployment of an Asp.NET MVC Application are

  1. Page not found error.
  2. Only the first page opens after setting URL routing.
Here are some of the solutions I found helpful. I have used them. Hopefully they work for you :)..

I have given the detailed instructions for everyone to understand.

Basic IIS setup

  • Install the IIS
  • Install .Net framework 3.5 SP1 (Install after IIS is installed because permissions are not set properly if these steps are interchanged)
  • If IIS is installed after .Net, try resetting the Framework by
  • C:/Windows/Microsoft .Net/Framework/V2.0xxx/aspnet_regiis –i
  • Install the application or copy paste (depends on how you want to deploy)
  • Configure the IIS as follows
  1. Add the Application to the server under the default websiteRight-Click->Properties.
  2. Under the virtual directory select Configuration
  3. Under Mappings select Add
  4. Give the path of asp api in Executable i.e “C:/Windows/Microsoft .Net/Framework/V2.0xxx/aspnet_isapi.dll”
  5. Give the extension as “.*”
  6. Uncheck the “Check that file exists”
  7. If Ok button is disabled click on the text box of Executable.
  • Make changes in the application as needed so that URLs are relative to Hosting Environment(Refer below on how to modify MVC URLs for deployment).
  • Also you have to change the DataBase folder i.e. App_Data`s permission to R/W else “Cannot write to database” error occurs.
The above steps ensure that your Asp.NET MVC app runs, i.e. first problem is solved.

How to modify MVC URLs for deployment

  • Usually when we write a Asp.Net MVC app, we give the URLs as "/Home/abcd" but this wont work as "/" is not the root of project but it is the root of the application in the website deployed.
  • To solve this problem we have a URL provider for Asp.NET MVC. It takes the Controller, Action as parameters and returns a URL for navigation
example : We can rewrite the following URL "/Home/abcd" as URL.Action("abcd","Home");

This will solve the second problem :)