How to Auto Refresh / Re Load Page

Sometimes we need a page which shows real time date e.g. Stock exchange, cricket match, etc. To add auto refresh / re load you need to add the following meta tag in your markup's head section.
<meta http-equiv="refresh" content="600">

If you want to add this from code behing, then you can add it like this:-
protected void Page_Load(object sender, EventArgs e)
{
HtmlMeta hmRefresh = new HtmlMeta();
hmRefresh.HttpEquiv = "Refresh";
hmRefresh.Content = "10";//Time in seconds
Page.Header.Controls.Add(hmRefresh);
}

System.UnauthorizedAccessException: Access to the path 'C:\inetpub\wwwroot\...' is denied


This exception is a very common exception. It usually occurs when we move our application to IIS server (usually on production environment).

This exception occurs because IIS uses ASP .Net (IIS_IUser in Vista) user account and ASP .Net is not authorized to access that location.

To give a quick fix to this, follow these steps:-

  1. Give read/write rights to ASP.NET user to C:\Inetpub\yourfolder\ folder:-
    1. Right Click on FOlder and Select Properties
    2. Go to Security Tab
    3. Click Add, then click Location.
    4. Select your pc name, usually first item.
    5. Press Ok, then press advance and then Find Now.
    6. Select ASP.NET user if not exist then select Authenticated Users.
    7. Press Ok. And Select Read/Write/Modify/List Folder Contents.
  2. Go to IIS->WebSites->DefaultWebSite->YourSiteName->Properties, and at Virtual Directory Tab check 'Read' and 'Write' button.

How to Enable Internet Explorer Advance Tab in Vista


Recently my system got crashed and IT guys installed windows Vista on it, by default they have disabled Advance Tab in Tools-> Internet Options. And I was unable to debug Javascript through my Visual Studio.

After searching the net for a while i found a registry key which opens that option:-


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Control Panel]
"AdvancedTab"=dword:00000000


Save this code as IE.reg and double click on it. After that I was able to view Advance Tab in IE and enabled javascript debugging in IE.

Just for refrence I am adding the path to enable javascript debugging in IE.

Tools-> Internet Options -> Advance -> Check Disable Script debugging (Internet Explorer)

Tools-> Internet Options -> Advance -> Check Disable Script debugging (Others)