Wednesday, October 13, 2010

How to create IIS Log [IIS 6.0]

1. Open [Internet Services Manager]

2. For [Default Web Site], Right click and open [Properties]

3. In the tab, [Web Site], enable the checkbox [Enable Logging]

4. Select [Active Log Format] as [W3C Extended Log File Format]

5. Click on the button [Properties]

6. In the [General Properties] tab, select [Daily] for [New Log Time Period]

7. In the [Extended Properties] tab, select the following fields

I. date

II. time

III. s-sitename

IV. s-computername

V. s-ip

VI. cs-method

VII. cs-uri-stem

VIII. cs-uri-query

IX. s-port

X. cs-username

XI. c-ip

XII. cs-version

XIII. cs(User-Agent)

XIV. cs(Cookie)

XV. cs(Referer)

XVI. cs-host

XVII. sc-status

XVIII. sc-substatus

XIX. sc-win32-status

XX. sc-bytes

XXI. cs-bytes

XXII. 22. time-taken

8. Apply the configuration changes

Monday, March 1, 2010

Browser detection using JavaScript

Browser detection allows you to find out what browser your viewer is using .

There are two objects often used for this,

1.navigator.appName

2.navigator.appVersion

The first one returns the name of the browser, the second returns the version of the browser.

ex:
function aa()
{
var browserName=navigator.appName;
if (browserName=="Netscape")
{
alert("Netscape User");
}
else
{
if (browserName=="Microsoft Internet Explorer")
{
alert("InterNet Explorer User");
}
else
{
alert("Other browser User");
}
}
}

Friday, February 19, 2010

MD5 Hashing In C#

using System;
using System.Security.Cryptography;
using System.Text;

MD5 md5 = MD5.Create();
byte[] data = md5.ComputeHash(Encoding.Default.GetBytes("neeraj"));
StringBuilder s_builder = new StringBuilder();
foreach (byte b in data)
{
s_builder.Append(b.ToString("x2"));
}

Response.Write(s_builder);