I do have SPA application that use some functionality of ASP.NET MVC4 like AntiForgeryToken.
I don't know how to implement AntiForgeryToken functionality in HTML without use of CSHTML which is not supported in Phonegap?
I do have SPA application that use some functionality of ASP.NET MVC4 like AntiForgeryToken.
I don't know how to implement AntiForgeryToken functionality in HTML without use of CSHTML which is not supported in Phonegap?
I think there is a secure way to implement an anti-forgery token without a server generated page:
Microsoft has provided a very similar example implementation here (see section titled 'Anti-CSRF and AJAX').
On the surface this may seem insecure because you have a controller method that sets and returns the anti-forgery token, but web browsers enforce the same origin security policy, so XSRF attacks should not be possible.
Since phonegap uses local files it is not subject to the same origin policy (see here) so it will be able to make AJAX requests to any domain specified in your config.xml (see <access origin="..." /> here)
The current implementation of the AntiForgery token in ASP.NET MVC relies on the HTML helper which generates a hidden input field and sets a cookie. If you cannot use this helper you will have to roll this functionality by yourself.