1

I have an application that has an object that carries the current users credentials, i.e. userID and email address etc. The application at some points will call a shared ajax repository to perform certain actions in an automated way, which is done by creating an new HttpWebRequest and then posting the data over.

Is it possible at this point to carry the user session in the HttpContext.Current over to the HttpWebRequest to appear as if they are making the call, so that the HttpWebRequest is already authenticated and has the users object available.

Ross
  • 165
  • 2
  • 12
  • Save the session cookies you get from the first request and use them in the second request. – Qurben Jul 01 '15 at 15:16
  • Hmm, just tried your suggestion, I can set the cookies on the HttpWebRequest cookie container, but now that I've done that, the Web Request times out, if i don't set the cookie container, it doesn't time out but also doesn't work! – Ross Jul 01 '15 at 15:31
  • Does http://stackoverflow.com/q/8285500/598115 help you with that? – Qurben Jul 02 '15 at 07:18
  • I've tried extending the timeout and also changing the connection limit. What seems to be happening is that adding the cookie from the context to a container, then attaching this to the request hangs up the new httpwebrequest for some reason, however, once it times out, the request is actually processed – Ross Jul 02 '15 at 13:19

0 Answers0