I want to make a GET action that only runs if it is called by another action, so not if the user types the URL in the address bar. What can I check to determine whether this is the case?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You may decorate the action with the ChildActionOnlyAttribute.
You may then use the RenderAction() and Action() Html helpers as usual and the action cannot be called by URL.
These are new to MVC 2, but from the tags I assume that you are already using that.
Sample: http://haacked.com/archive/2009/11/18/aspnetmvc2-render-action.aspx