I have a HttpHandler which queries 3 web services within a single request and store the results in a single cookie.
As you would imagine, the results collide. Here is how:
Process is as follows: when i query service 1 and waiting for the result, the cookie i m storing the results doesnt exist yet, then result comes from service 2 and volia, creates the cookie, stores the result, and then response comes back from service 1 and overwrites that cookie, which shouldnt be the case.
what i d like is to queue these requests.
Should i do it on client side via javascript? if yes, how ?:)
or do it on server side ?
so i dont want asynchronous calls. right?
here is the code:
if(service1.isEnabled){
invokeService1();
}
if(service2.isEnabled){
invokeService2();
}
if(service3.isEnabled){
invokeService3();
}
invokeService1(){
callToService1();
// response comes to another HttpHandler, which is a redirect from the service
}
invokeService2(){
callToService2();
// response comes to another HttpHandler, which is a redirect from the service
}
invokeService3(){
callToService3();
// response comes to another HttpHandler, which is a redirect from the service
}
when the responses arrive to the HttpHandler, it comes with querystring.
then on that HttpHandler:
HttpCookie cookie = request.Cookie.Get(MYCookie) ?? new HttpCookie(MYCookie);
if(request.Params["foo"]){
//set cookie content
}
if(request.Params["Bar"].isNotNullOrEmpty()){
//set cookie content
}
this is how i set it. The way i create the cookie is a problem I think.