开发者

Accessing "Request" object properties using jquery

we are developing a web application using MVC3 and Jquery. we have a situation where we need to check the request is authenticated (@Reques开发者_开发百科t.IsAuthenticated) using Jquery. what is the best way to do that using Jquery?

Thanks.


make a helper action on one of the controllers or maybe on a Base controller and return a ContentResult (with a value of true or false). Use jquery's ajax() function to perform asynchronous GET request to the server side controller action.

If you can afford to have the Javascript code inside the view then you can simply do

@if(Request.IsAuthenticated)
...do Javascript...
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜