Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 02, 2012 01:35 PM by BrockAllen
May 02, 2012 07:39 AM|LINK
I have some partial views in my controller. The problem is that users can visualize my partial views if they put in url: (www.mydomain.com/mycontroller/mypartialview). How can I deny direct access... and allow work with partial views only from base view?
May 02, 2012 07:47 AM|LINK
The problem is that users can visualize my partial views if they put in url: (www.mydomain.com/mycontroller/mypartialview)
MVC denies direct access to your views (that ends either in aspx/ascx, either in cshtml/ vbhtml)
is an ACTION, not a View ( even partial).
More, it is your code - MVC does not make any action WITHOUT implementing( look at default template)
So delete the action that renders the partial view.
allow work with partial views only from base view?
What's the code in the base view?
May 02, 2012 01:35 PM|LINK
If these actions are being used as child actions with Html.Action() then you can put [ChildActionOnly] on the action methods to prevent them from being accessed directly from the browser.