How can i prevent a partial view from being loaded by typing http://mydomain.com/site/edit/1 Is there any way of doing this?
/Martin
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.
If you load your partials through Ajax then you can check if the request HTTP header
HTTP_X_REQUESTED_WITHis present and its value is equals toXMLHttpRequest.When a request is made through the browser that header is not present
Here is a very simple implementation of an Action Filter attribute that does the job for you
You can use it to decorate any action where you want to check if the request is an ajax request