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 8082613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:10:16+00:00 2026-06-05T17:10:16+00:00

So that’s a long title, here’s what I’m doing: To avoid having report parameters

  • 0

So that’s a long title, here’s what I’m doing: To avoid having report parameters show up in the URL I’m doing this in a button click handler in the code-behind to show the report:

System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.Write("<html><head></head>");    
System.Web.HttpContext.Current.Response.Write("<body onload=\"document.mainform.submit(); \">");
System.Web.HttpContext.Current.Response.Write(string.Format(CultureInfo.InvariantCulture, "<form name=\"mainform\" method=\"post\" action=\"{0}\">", ReportURL));
foreach (string key in Params.Keys)
{
    System.Web.HttpContext.Current.Response.Write(string.Format(CultureInfo.InvariantCulture, "<input name=\"{0}\" type=\"hidden\" value=\"{1}\">", key, Params[key]));
}
System.Web.HttpContext.Current.Response.Write("</form>");
System.Web.HttpContext.Current.Response.Write("</body></html>");

This works great, but when I go back from the report I’m taken to the page I just generated which immediately submits the form due to the onload event. I can hit back twice really quickly to go back past it but this isn’t ideal.

I’ve tried opening a new window with JavaScript using ClientScript.RegisterStartupScript before writing the html but I don’t know how (or if it’s even possible) to get the HttpContext for the new window.

  • 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-06-05T17:10:18+00:00Added an answer on June 5, 2026 at 5:10 pm

    I ended up opening a new window. I added two small javascript functions

    function openNewWin() {
        $('form').attr('target', '_blank');
        setTimeout('resetFormTarget()', 500);
    }
    
    function resetFormTarget() {
        $('form').attr('target', '');
    }
    

    Then in the linkbutton I set

    OnClientClick="openNewWin();"
    

    The OnClick still executes the code above server-side but the response is written to the new window. The setTimeout in the openNewWin function resets the form’s target property so the app will still function normally after coming back to it.

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

Sidebar

Related Questions

That show up on menu bar It's like this question: How to create a
That's a really awkward title :) I need to write a report that generates
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That title is presumably awfully worded. I have some PostgreSQL tables. There is a
That's how I'm new in here on the website so it would be super
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That should be simple web site but with an editable tree. This tree will
I am doing a simple coin flipping experiment for class that involves flipping a
That is, why does this: struct S {}; struct T { T(S& s) :
That is, all text and subtags, without the tag of an element itself? Having

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.