Reputation: 305
I have a web application ... using URL in browser history anyone can able to access the page. Is there any way to disable accesssing page from history or typing the url in address bar?
For example , staffs and managers using this website. some pages are only accessible by managers. but using url in history staff also accessing this page.
My question is "Is there any way to clear the history in asp.net?"
Upvotes: 1
Views: 676
Reputation: 898
As i understand your question, if you want your page should not open directly by Url then you can do it by this way
Uri u = HttpContext.Current.Request.UrlReferrer;
if (u != null)
return true;
else
{
//Here user try to hit your Page url directly
//Then you can redirect that user to your default Page or Home Page
return false;
}
Upvotes: 3
Reputation: 731
If I understand you question right, you dont want to someone to access your page from browser history or by typing it in the address bar? The answer is no, you cannot restrict it like that unfortunately. A bit more context would be helpful
Upvotes: 1