I have a page that shows some data depending on the id param in request.
The user must be logged in
How should I stop the user from accessing certain ids that belong to other users. Is redirect the best choice?
You can check on the server-side before rendering the page, then redirect...etc:
void Page_Load(object sender, EventArgs e)
{
string bla = Request["key"] != null ? Request["key"] : "";
if(String.IsNullOrEmpty(bla))
if (bla=="yourvaluetocheck" && !User.IsInRole("theroletouse"))
{
Response.Redirect("~/permissiondenied.aspx");
}
}
This a very simple example, I would put this type of logic in a central place in my application for re-use.