In my Jquery,
getcustomHeaders function returns
{
"customHeaders": {
"customId": "26",
"screenData": "width=1920&height=1080&scaling-factor=1&colour-depth=24",
"screenSize": "width=1920&height=1080",
}
}
Another function does,
$.ajax({
url: 'someName/Submit?productId=' + productId,
type: 'post',
headers: getcustomHeaders()
})
.success(function(d) {
if (d && d.responseJSON && d.responseJSON.Message) { alert(d.responseJSON.Message); }
})
.error(function(d) {
if (d && d.responseJSON && d.responseJSON.Message) {
alert(d.responseJSON.Message);
} else {
alert(display_some_error_message);
}
});
In .Net,
var request = HttpContext.Current.Request;
request.Headers["customHeaders"];
— Returns the current object, but cannot access the values from the object.
I tried,
request.Headers["customHeaders"]["customId"] -- NameValueCollection doesn't contain a definition for 'customHeaders'
request.Headers["customHeaders"].GetValues("customId").FirstOrDefault() -- 'string' does not contain a definition for 'GetValues'
Can any one point out me how to get the value of ‘customId’ please?