Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 673707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:37:32+00:00 2026-05-14T00:37:32+00:00

I am developing a .NET 3.5 Web Forms based website that uses URL Routing.

  • 0

I am developing a .NET 3.5 Web Forms based website that uses URL Routing. So far I have created a few routes and I have had no issue. I now have a .ashx file that is going to handle sending .pdf files from a table in SQL Server to the website when someone clicks on a link. Normally when I create a Handler it would look 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 doesn’t work though because fileserver.ashx is not a page so casting it as typeof(Page)) as Page is going to fail. What do I cast the VirtualPath as instead of Page or is there some other way I should be doing this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:37:33+00:00Added an answer on May 14, 2026 at 12:37 am

    use typeof(IHttpHandler) instead of typeof(Page)

    That is the base class of the ashx file Also change the return type from as Page to as IHttpHandler. Then update any other code that depends on it being a page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an ASP.NET web application that incorporates google maps. I have an
We are developing a web application that uses forms authentication and the ActiveDirectoryMembershipProvider to
We are developing an ASP.NET Web Forms application with REST modelled URL, for which
When developing ASP.NET websites (using VB.NET web forms) - a lot of my time
I'm about to start developing a web-based application that I can best describe as
I am developing a website(web forms , not MVC) in VS 2008(with SP1 ).I
I have two questions: I am developing a web system in asp.net mvc with
I am developing an asp.net web form application that displays some info on separate
I am developing an Windows Forms application using VB.NET that offers the user to
I'm developing a web application based on ASP.NET MVC. There are a large database.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.