I'd like to gain control over the construction of a WebService instance in ASP.NET.

This is what I did so far: I created a .ASMX file and pointed it to a Class with WebServiceBinding and WebMethod attributes attached to it as usual. At the time I browse to the .ASMX file ASP.NET will automatically create an instance of the Class for me.

Is it somehow possible to hijack into the object factory of ASP.NET and do the instance creation by my self?

No correct solution


You could write a custom handler (.ashx) and do it manually that way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow