Hi
I have a page called SearchDcouments.aspx that displays all the matching documents as Hyperlinks in the table format as below. When the User clicks on any particular document, the sample url will be:
http://localhost:52483/Home/ShowDocument?docID=280
So that the DocumentID is passed as Querystring to the ControllerMethod ShowDocument and the ID is visible in the URL. Now for Security purposes, I want to hide this way of passing the Querystring parameters.
Wondering what are the alternatives to hide the DocID from the URL?
Appreciate your responses.
Thanks
Code in the View:
<tbody>
<% foreach (var item in Model){ %>
<tr>
<% string actionTitle = item.DocumentType.ToLower() == "letter" ? "Request References" : "Request Slides"; %>
<td>
<%= Html.ActionLink(actionTitle, MVC.Home.ShowDocument(item.DocumentID))%>
</td>
</tr>
<% } %>
</tbody>
Code in the Controller:
[Authorize]
[HttpGet]
public virtual ActionResult ShowDocument(int docID)
{
Document document = miEntity.GetDocumentByID(docID);
switch (document.DocType.ToLower())
{
case "slide":
SlideRequestViewModel slide = new SlideRequestViewModel(docID);
return View(MVC.Home.Views.ShowSlideRequest, slide);
case "letter":
RefRequestViewModel rrq = new RefRequestViewModel(docID);
return DoShowRefRequest(rrq);
default:
break;
}
// Here - let's get back home
return RedirectToAction(MVC.Home.Default());
}