sara
sara

Reputation: 305

how to prevent accessing web page using history in asp.net

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

Answers (2)

Nitin Kumar
Nitin Kumar

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

snit80
snit80

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

Related Questions