0

I'm not even sure how to put this question in the title of this question (?!).

I've got a "private" view that when user is logged in, besides useful info, it also has inputs to send an email.

I don't want that private View to show if the logged in user types it into the URL of the browser. In the controller I want to check the last View that user came from and redirect him to a "public" copy of the View with no email functionality.

here is pseudo code:

If previous View = "xxx" Then
open private View
ELSE
open public View instead
tereško
  • 58,060
  • 25
  • 98
  • 150
JustJohn
  • 1,362
  • 2
  • 22
  • 44

1 Answers1

0

After finding this great SO thread I used some of it in the "PrivateDetailsOfStore" Controller ActionResult:

string previousView = Request.UrlReferrer.ToString();

if (previousView != "http://localhost/StoreMaster/Stores/PickLocation")
{
    RedirectToAction("PublicDetailsOfStore", (id));
}

And yes, I know I will have to change the previousView check when going into production and not using "localhost".

Community
  • 1
  • 1
JustJohn
  • 1,362
  • 2
  • 22
  • 44