Showing posts with label WWW. Show all posts
Showing posts with label WWW. Show all posts

How to refresh a page at regular interval of time ?


Monday, December 14, 2009

Solution :

It seems to be very tough task to do this, but acutaly it is not.

you can do this by adding one line code in your HTML code.

you just have to put meta tags in <head> part of your html code.

Please find the code below showing, where you need to put the code to refresh a page at regular interval of time.

To change the time interval, you just have to change the CONTENT value, currently i have placed 3, change accouring to your need.


<head runat="server">
<title>Asp.Net Developer, Resource mall for developer</title>
<META HTTP-EQUIV="Refresh" CONTENT="3;URL=http://www.rajeshssingh.blogspot.com/">
</head>



Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Asp.Net Developer
Indianic Infotech Ltd (India)
rajesh@indianic.com

How to add www prefix to my domain name in address bar ?




Solution :

Mostly User dont type "www" before our domain name, either they are searching in google or directly into address bar of browser.

for example, user type "indianic.com" in address bar of browser.

then the url of our website looks like this "http://indianic.com", this really looks odd.

what if our URL automatically redirect to http://www.indianic.com, Yes now its look nice and seo friendly.

This is possible, by adding just below code in your page load event in c#.

For other languages developer, need not need to worry, this is simple "if condition", you can easlily covert it into your language.

Please find below sample code.


protected void Page_Load(object sender, EventArgs e)
{
if (Request.ServerVariables["SERVER_NAME"] != "localhost")
{

if (sCheckUrl.IndexOf("http://") == 0)
{
if (sCheckUrl.IndexOf("http://www.") != 0)
{
Response.Redirect(sCheckUrl.Replace("http://indianic", "http://www.indianic"));
}
}
else if (sCheckUrl.IndexOf("https://") == 0)
{
if (sCheckUrl.IndexOf("https://www.") != 0)
{
Response.Redirect(sCheckUrl.Replace("http://indianic", "http://www.indianic"));
}
}
}
}


Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Asp.Net Developer
Indianic Infotech Ltd (India)
rajesh@indianic.com