Thursday, November 20, 2008

How to make Visual Studio 2005 build process faster

To make build process in visual studio 2005 faster, change Start Action in property page.



Right click on the solution and click on properties. Change Start action into 'Build Page' instead of 'Build Website'

Add To Google BookmarksStumble ThisFav This With TechnoratiAdd To Del.icio.usDigg ThisAdd To RedditTwit ThisAdd To FacebookAdd To Yahoo

Thursday, October 23, 2008

Resetting the identity field in SQL Server

Resetting identity field in SQL Server can be achieved by following command

DBCC CHECKIDENT('table name', RESEED, number_you_need_to_reset )

For eg:
If your customer table is empty and wanted to reset the identity field value to 1 then use the following comand

DBCC CHECKIDENT('customer', RESEED, 0 )

So next time when you add a record the identity field value will be 1.

Add To Google BookmarksStumble ThisFav This With TechnoratiAdd To Del.icio.usDigg ThisAdd To RedditTwit ThisAdd To FacebookAdd To Yahoo

Monday, September 8, 2008

How to prompt for Download for a known MIME type

Sometimes you may require a link to download some files like jpg, gif, html etc. But these are known mime types and if you just give a 'href' link it opens in the browser itself. To prompt the user for 'Save as' you need to use the following steps,

Response.ContentType = "application/x-unknown";
string fileName = "file.jpg";
string filePath = "d:\\" + fileName;
Response.AddHeader("Content-Disposition","attachment; filename=" + fileName );
FileStream fs = File.OpenRead(filePath);
BinaryReader br = new BinaryReader(fs);
Response.BinaryWrite(br.ReadBytes(Convert.ToInt32(fs.Length)));
Response.End();

This is code in c#. Similar way you can use this in any other scripting language.

Tags: Response.ContentType, Content-Disposition, ASP.NET, C#, Download a file using c# and ASP.NET

Add To Google BookmarksStumble ThisFav This With TechnoratiAdd To Del.icio.usDigg ThisAdd To RedditTwit ThisAdd To FacebookAdd To Yahoo

Tuesday, September 2, 2008

SQL Server Reporting Services Video download

Today i found a very good video tutorial on SQL Server Reporting Services and its really helpful for beginners to start with.

You can download the video here

Right clock on the link and select Save Link Location.

Watch the video and use full advantage of SQL Server Reporting Services. Its a better option comparing to Crystal Reports.

Add To Google BookmarksStumble ThisFav This With TechnoratiAdd To Del.icio.usDigg ThisAdd To RedditTwit ThisAdd To FacebookAdd To Yahoo

Saturday, August 30, 2008

Sys is undefined ajax javascript error

'Sys is undefined' javascript error. This error occurs when you try to add ajax framework and controls to an existing ASP.NET 2.0 application. The reason for this error is the contents of the web.config file. You have to upgrade web.config file when using ajax controls in an existing application.

Update the Web.config file with the following entry

<pages>
<controls>

<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </controls>
</pages>

and

<httpHandlers>

<remove verb="*" path="*.asmx"/>

<add
verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false"/>
</httpHandlers>


Make sure that these entries are proper in web.config.

Add To Google BookmarksStumble ThisFav This With TechnoratiAdd To Del.icio.usDigg ThisAdd To RedditTwit ThisAdd To FacebookAdd To Yahoo