IIS Url Rewriting - avoid repeat of querystring parameters

Using the URL rewriting mechanism of IIS causes repeat of querystring parameters on every postback, because it builds the postaback url (rewrites url) by appending the querystring to current url.

Actual url:

Rewritten url:

Rewritten url after postback:
which is actually equal to /product.aspx?type=hats&type=hats
So the type value is "hats,hats".

To avoid repeat of querystring variables simply check if the url is already rewritten:

protected void Page_Load(object sender, EventArgs e)
if ( !String.IsNullOrEmpty(Request.ServerVariables["HTTP_X_ORIGINAL_URL"]) )
form1.Action = Request.ServerVariables["HTTP_X_ORIGINAL_URL"];

Detailed description:

SQL Server Express and IIS: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path.

SQL Express user instancing fails with the default IIS 7.x configuration. To solve this you can do the following:

1. Create new application pool in IIS
2. Open Application Pool Advanced settings
3. Change Identity from ApplicationPoolIdentity to NETWORK SERVICE and confirm
4. Change the application pool that the web application belongs to by opening Advanced setting of the web application

3 ways to get date in SQL without time

Here are 3 ways of getting date-only part of timestamp in SQL Server:


2. CONVERT( datetime, FLOOR(CONVERT(float(24), GETDATE())) )


Passing Parameters to .NET Web Service as a Query String (GET Method) or POST Request

First of all the way of passing parameters must be defined in web.config as follows:

<add name="HttpGet"/>
<add name="HttpPost"/>

Then the URL of the web service may include parameters as query string.

MethodCaseSensitive is the name of web method to be performed as part of the webservice called webservice.asmx.

In case you need POST method of sending parameters just use a form and text fields as in the following example:

<form name="input" action="http://tempuri.org/webservice.asmx/MethodCaseSensitive" method="post">
<input name="parameter1" type="text">
<input name="parameter2" type="text">
<input value="Submit" type="submit">

Both of methods return XML response as it is defined in the web method.

The Web Service results can be easily checked using the .NET ability for integrated passing of parametersin a web interface:

The screen allows the user to enter web service parameters and submit them. The result is the same.

ASP.NET Page Life Cycle, event order, master page, page and control events order

    PAGE: Page.OnPreInit()
        USER CONTROL: UserControl.OnInit()
MASTER PAGE: MasterPage.OnInit()
    PAGE: Page.OnInit()
    PAGE: Page.OnInitComplete()
    PAGE: Page.OnLoad()
MASTER PAGE: MasterPage.OnLoad()
        USER CONTROL: UserControl.OnLoad()
    PAGE: Page.OnLoadComplete()
           Page Event Handlers
    PAGE: Page.OnPreRender()
MASTER PAGE: MasterPage.OnPreRender()
        USER CONTROL: UserControl.OnPreRender()
    PAGE: Page.OnPreRenderComplete()
    PAGE: Page.OnSaveStateComplete()
        USER CONTROL: UserControl.OnUnload()
MASTER PAGE: MasterPage.OnUnload()
     PAGE: Page.OnUnload()

More information here:
ASP.NET Page Life Cycle

How to add custom shortcuts in Save / Open dialogs on Windows Vista

1. Start Group Policy Editor by starting gpedit.msc
2. Navigate to:
User Configuration -> Administrative Templates -> Windows Components -> Windows Explorer -> Common Open File Dialog
3. Open "Items displayed in Place Bar"
4. Enter appropriate paths for you shortcuts

The changes take effect immediately.

Stop a postback by javascript with IE7

Somehow the statement javascritpt:return false; doesnt work with IE 7. But there is a workaround by setting the event.returnValue to false.

OnClientClick="javascript:event.returnValue=false; return false;"

Minifying javascript source files.

I just want to recommend you a very simple tool called JSMin, which helps minifying the javascript sources. This code improvement significantly decreases the download time because of the smaller page size. The toll successfully removes whitespaces and comments which are not needed on client side.

The tool is available as a script or a console application.

The usage of jsmin.exe is simple:
jsmin.exe output.js

Javascript Query String

The query string is reachable through window.location.search property. Splitting it by & gives you list of passed GET parameters.

function GetPageParameter(param) {
var query ='';
if (window.location.search.length>3){
//removes '?' from the query string
query = window.location.search.substring(1);
return '';
params = query.split("&");
for (i=0;i1){
if (pair[0] == param) {
return pair[1];
return '';
return '';

var value = GetPageParameter("value");