I have a page that when accessed has some sensitive information. I understand there are better ways to go about this like Active Directory, etc, but I'm aiming for the simplest way possible at the moment.
Is there a way to prompt the user for a string via textbox, whether it be with an alert or any other method, that will pause the DOM to be displayed and accessed via "view page source"? So that if entered incorrectly, the view is not returned?
Could someone please provide a code example?
The page I have currently is being accessed by this actionresult:
public ActionResult ViewRecords() {
return View();
}
Is there anyway to make is so that the code above relies on the correct string to be passed in like so:
public ActionResult ViewRecords() {
alert(//some sort of text box//);
if (string == 'password')
return View;
else
return View("Index.cshtml");
}
I've done some research and found some people doing this through a webconfig definition, but am confused on the exact code I'd need to put in both my web.config
, c# controller file, and .cshtml
view to make this work.