How do i restrict user from copying the url from the address bar an pasting it into another to open [Resolved]

Posted by Mahe under ASP.NET on 3/21/2013 | Points: 10 | Views : 5468 | Status : [Member] | Replies : 1
Hi All,

How do i restrict user from copying the url from the address bar an pasting it into another to open the same page ?
if the user tries to do that then he/she should land into home page.
Please suggest me to implement in C# asp.net 4.0.

Regards,
Mahe




Responses

Posted by: Mahe on: 3/21/2013 [Member] Starter | Points: 25

Up
0
Down

Resolved
if (!Request.FilePath.Contains("Default"))
{
string strPreviousPage = "";
if (Request.UrlReferrer != null)
{
strPreviousPage = Request.UrlReferrer.Segments[Request.UrlReferrer.Segments.Length - 1];
}
if (strPreviousPage == "")
{
Response.Redirect("Default.aspx");
}
Adding the above code in master page will work. considering the "Default.aspx" as the home page.

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response