Chris
Chris

Reputation: 2991

How to tell who called an HttpHandler

How can I tell from within an ASP.NET HttpHandler if it is executing because of a call to

Server.Execute("myHandler.ashx")

or because of the user linking directly to myHandler.ashx? (Besides using a querystring parameter).

Upvotes: 0

Views: 184

Answers (2)

Joel Etherton
Joel Etherton

Reputation: 37533

You should still have access to the HttpContext from within the handler, so you should still be able to access cookies and session to determine any authenticated users (if that's what you're looking for).

Upvotes: 0

Claudio Redi
Claudio Redi

Reputation: 68400

Can't you add a querystring parameter? If present comes from Server.Execute(), otherwise direct link.

Upvotes: 2

Related Questions