What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 21079 |  Welcome, Guest!   Register  Login
 Home > Blogs > ASP.NET > Response new function named as Response.RedirectPermanent ...
Mail2varunkhanna@Gmail.Com

Response new function named as Response.RedirectPermanent

 Blog author: Mail2varunkhanna@Gmail.Com | Posted on: 10/23/2012 | Category: ASP.NET Blogs | Views: 433 | Status: [Member] | Points: 75 | Alert Moderator   


OVERVIEW 

Recently, I came to know about the new function of Response named as Response.RedirectPermanent. So what is Response.RedirectPermanent? Where to use it? So, in this article we would have brief overview of Response.RedirectPermanent. 


RESPONSE.REDIRECTPERMANENT

Consider a following scenario:
We have a web application which sells products to end users. In order to increase the user count or to bring more users to the website, company decides to start with discounts on certain products. Hence, it introduces the new page named as Discount.aspx listing all the products which has discounts on them. When user clicks on any of the discounted products, website redirects the user to page named as Products.aspx where user can view the details of product.
In order to increase the revenue company hires the SEO and registers the page on different search engines like Google, Yahoo etc. Hence, discount page gets registered on different search engines.

Now, after some months company decides that it don't want to give discounts on the products and thinks of removing the page. But they don't want to lose their customers who were coming to their site through discounted page.

In this case, we have two options
1) Copying the content of products page to discounted page
Disadvantage: When search engines see the same data on both discounted and products page, they can penalize the site for having the duplicate content and would delist the site.

2) Use Response.Redirect
We can use Response.Redirect on the page load of discounted page which would redirect the user to products page.
Disadvantage: When we use response.redirect, then it returns the status code as HTTP 302 temporarily redirected to different search engines.So, search engine store this information in their table that this discounted page had returned status code HTTP 302 and it was temporary re-directed.
Search engines expect that next time when we would hit discounted page, it would show the data and shouldn't return 302 status code. If next time again, page returns status code 302 then search engine penalizes the site and would delist the site.

Hence, in this scenario we should always use Response.RedirectPermanent.
What does Response.RedirectPermanent?
When we use Response.RedirectPermanent then it returns status code HTTP 301 Moved Permanently.It tells different search engines this page has permanently moved to new page. By this different search engines updates their index with new page. So, next time if someone clicks on discounted page, user would be automatically directed to products page by search engines.

So, let's build a small application, which would have  two buttons - one button would use Response.Redirect and other button would use Response.RedirectPermanent. 

We can view the GET request details by using the tool named as HTTPDebugger.Below are the GET request. You can see that when we have use Response.Redirect then browser has returned status code as 302 Found; however in case of Response.RedirectPermanent status code returned is 301 Moved Permanently. 
Below is the screenshot




CONCLUSION

Whenever we want to remove any page from website, we should always use Response.RedirectPermanent. With this we wouldn't loose our customers directed to our site through different search engines.

Hope with this article, we would have brief overview of Response.RedirectPermanent.


Found interesting? Add this to:



 More Blogs from Mail2varunkhanna@Gmail.Com

 More ...

About Varun Khanna

Experience:6 year(s)
Home page:http://varunkhanna.blogspot.com/
Member since:Tuesday, October 16, 2012
Level:Starter
Status: [Member]
Biography:
>> Write Response - Respond to this post and get points

More Blogs

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/22/2013 2:21:16 PM