My asp.net application have form authentication. When user logs in, he is redirected to a new page abc.aspx. On this page, in javascript, on document.ready, a service call is made to some service which have AspNetCompatibilityMode on. In the interceptor of the service, I try to find the HttpContext.Current but when its the first request to the application, interceptor does not get HttpContext.Current and is found null. After that, its never null but only on the first request to the application.
Asked
Active
Viewed 845 times
0
-
can you put some code up so we can help? – Chris May 29 '12 at 06:50
2 Answers
2
If you use WCF, in the wcf there is no HttpContext.Current. You have to use the InstanceContextMode of the Service class in the Session.

Peter
- 27,590
- 8
- 64
- 84
-
If AspNetCompatibilityMode is on then you can get the HttpContext. I am getting it in subsequent calls, but the problem is in the first call only. I think that is somewhat related to form authentication where the cookie is generated. – Ankit May 29 '12 at 12:02
1
Correctly said by Peer, there is no HttpContext in WCF. You may use OperationContext.Current.RequestContext
You would have to follow below link
http://www.danrigsby.com/blog/index.php/2008/05/23/understanding-instancecontext-in-wcf/

Ravi Vanapalli
- 9,805
- 3
- 33
- 43