I am using jQuery within a server side control to post back to a common handler.
For instance, I have "/handler.ashx" which services pages all over my application.
How I want some code within handler.ashx to be able to get the class which created the page that the control is on. In handler.ashx I can see the referer (for example Referer:http://localhost/Playground/form2.aspx
). However, I don't know how to use that URL to get the class Playground.Form2.
Ideas:
I could obviously parse the URL and assume that is the class name, but that isn't safe.
I could use reflection to iterate through all classes which extend from
Page
, and check theTemplateSourceDirectory
and/orAppRelativeVirtualPath
to see if it is the correct object.
However, I was wondering if there is some method available I can use, or if anyone recommends not going down this road in the first place.