开发者

Preventing Execution on Child and Ajax Requests

we are using asp.net mvc-3 for our application. we populate a property of controller from db on initialize method of contro开发者_运维技巧ller. i don't want this code to be executed on partial requests and ajax requests. is there some way i can achieve this without directly accessing Request object? Any suggestions in change of approach are also welcome


Why not use the Request.IsAjaxRequest if its available? If you don't want this property you need to access a header, which is in the request object anyways. The partial request won't hit your controller anyways - only RenderAction will hit your controller. RenderPartial will only hit your view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜