基于Ajax的Web应用程序 - 在Facebook登录之后模拟真实请求 [英] Ajax based web application - Mocking a real request after facebook login
问题描述
我在ASP.NET WebForms平台上使用C#的Facebook SDK。
整个应用程序是基于AJAX的,这意味着在用户决定登录(使用Facebook JS API)并重新加载页面之后,从那一点开始的整个通信是基于ajax的。
我想知道是否有办法使AJAX请求以与手动通过浏览器完成的方式相同 - 这意味着所有相关的Facebook和当前会话cookie将被发送在其标题中。我问这个,因为我不想创建一个自定义协议,它将标识ajax请求的用户。
希望我以后是明确的这个帖子...
这是我的应用程序屏幕截图,它是ajax,在你的情况下,和
- 这个ajax调用是本地ajax(=到同一个域)
- 它为每个ajax调用发送cookie,锚链接(通过浏览器完成,每次呼叫在浏览器中发送存储的cookie)
- 请求标头中的X请求 - 使用字段可以帮助您了解这是否ajax调用或不,更多信息在这里:如何知道请求是否在Application_Error()中的asp.net中是ajax
I'm building an ajax based web application which lets Facebook users who login to the application, enjoy certain advanced options of the application, like saving their settings, etc` (the user doesn't HAVE to login to his facebook account, but it gives him extra privileges).
I'm using the C# Facebook SDK on ASP.NET WebForms platform. The entire application is AJAX based, which means that after the user decides to log in (using Facebook JS API) and reload the page, the entire communication from that point on is ajax based.
I was wondering if there's a way to make those AJAX requests in the same way I would've done it manually through the browser - meaning that all related facebook and current session cookies will be sent in it's headers. I'm asking this since I don't want to create a custom protocol which will identify the user of the ajax request.
Hope what i'm after is clear through this post...
This is my app screen shot, it is ajax as in your case and:
- this ajax call is to local ajax(=to same domain)
- it sends cookies for each ajax call and anchor link(done by browser, send stored cookie in browser for each call )
- X-Requested-With field in the request header helps you understand if this is ajax call or not, more information here: How to know if the request is ajax in asp.net in Application_Error()
这篇关于基于Ajax的Web应用程序 - 在Facebook登录之后模拟真实请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!