asp.net of C cross domain and cross domain write Cookie problem
- 2020-05-16 06:41:34
- OfStack
The solution:
//www.B.com The page to be called needs to be written P3P Head, thereby lifting IE To write Cookie The stop
context.Response.AddHeader("P3P", "CP=CAO PSA OUR");
//www.A.com In addition to the ajax call www.B.com When the content is cross-domain access, need to use jsonp, In order to cooperate with its work need to add the following two sentences, generate jsonp return
context.Response.ContentType = "text/plain";
context.Response.Write(string.Format("{0}('OK')", context.Request["callback"]));
//jsonp The call does cross-domain access
jQuery.ajax({
url: url,
type: 'GET',
data: data,
dataType: 'jsonp',
success: function (data) {
window.location.href = toURL;
}
});