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

  • SEARCH
  • Home
  • 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 850649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:17:51+00:00 2026-05-15T07:17:51+00:00

We’re trying to create a .NET aspx page that will have a PDF within

  • 0

We’re trying to create a .NET aspx page that will have a PDF within it. Doing this by hardcoding it is easy.

<object height="1250px" width="100%" type="application/pdf" data="our.pdf">
    <param value="our.pdf" name="src" />
    <param value="transparent" name="wmode" />
</object>

(don’t worry too much about the transparent thing…we’re doing that for other reasons…but I include it here “just in case”.)

The problem is when we want to generate the PDF dynamically. Our code to populate the literal on the front end looks like this:

ltrPDF.Text = String.Format("<object height=\"1250px\" width=\"100%\" type=\"application/pdf\" data=\"ourPdfGenerator.aspx?var0={0}&var1={1}&var2={2}\">", var0, var1, var2);
ltrPDF.Text += String.Format("<param value=\"ourPdfGenerator.aspx?var0={0}&var1={1}&var2={2}\">", var0, var1, var2);
ltrPDF.Text += "<param value=\"transparent\" name=\"wmode\"/>";
ltrPDF.Text += "</object>";

Kind of ugly, but it seems like it should work. But it doesn’t.

When I debug, and put a breakpoint on the first line of ourPdfGenerator.aspx.cs Page_Load method, I reach the breakpoint without any difficulty. However, the first thing we do is try to use Request.QueryString:

string var0 = Request.QueryString["var0"];

which immediately throws an HttpException: “Request is not available in this context.” I’m not clear on:

  • Why isn’t it available?
  • What can I do about it?

EDIT: (as an aside, I know it seems a bit weird to ask for a mime-type of pdf from a aspx page…but we’ve used an aspx page to generate cs pages before…we do something like this:

Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment;filename=\"our.pdf\"");
using (MemoryStream pdfStream = new MemoryStream())
{
    ourSpecialPdfGenerator.ExportToPdf(pdfStream);
    Response.BinaryWrite(pdfStream.ToArray());
}
Response.End();

And this has been working fine in other contexts for a while…but always as its own page. What we’re doing differently now is instead of having this page called directly, we’re trying to embed it, so it’s being called from the <object> tag, which is apparently causing problems…

  • 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-15T07:17:52+00:00Added an answer on May 15, 2026 at 7:17 am

    The error is in ourPdfGenerator.aspx.cs. Your object tag is fine. Can you post the code to ourPdfGenerator.aspx.cs?

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

Sidebar

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.