I am developing a .NET 3.5 website based on web forms that uses URL routing. So far I have created several routes, and I had no problems. I now have a .ashx file that will handle sending .pdf files from a table in SQL Server to the site when someone clicks on the link. Usually, when I create a handler, it looks like this:
return BuildManager.CreateInstanceFromVirtualPath("~/ViewItem.aspx", typeof(Page)) as Page;
For my .ashx file, I tried:
return BuildManager.CreateInstanceFromVirtualPath("~/FileServer.ashx", typeof(Page)) as Page;
This does not work because fileerver.ashx is not a page, so set it to typeof (Page)), because the page will fail. What am I doing VirtualPath instead of a page or is there some other way that I have to do this.
source
share