简体   繁体   中英

using azure mobile services with MVC application

I need to interact with my Azure Mobile API. Upon login I get an authentication token that is sent with every request. Adding Azure Mobile services to my MVC causes Html helpers to stop working.

How can I get around this? if it is not possible, can someone show me how to add an Header to an AJAX request for a Azure Mobile API request? And is it possible to pass the server response to my controller?

accessing the database without the API is not really a option. I have a client Xamarin Application that uses it.

OK, so I manage to work around my solution.

this link helped: http://developers.de/blogs/damir_dobric/archive/2014/04/29/consuming-azure-mobile-service-custom-api-with-net-backend.aspx

so basically this is how it works: Azure mobile library breaks any MVC project so it was uninstalled.

Include: Newtonsoft.Json this class is needed to map your response objects to whatever your classes look like.

Keep an close eye to what your uri looks like. Usually is something like https://Your-API-link.net/api/controller (remember that get requests have values added as part of the link and post as part of the header) I used JsonConvert.DeserializeObject<> for the response mapping

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM