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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:44:53+00:00 2026-05-11T23:44:53+00:00

i want a handler to redirect to a web-forms page, pre-filling in the values

  • 0

i want a handler to redirect to a web-forms page, pre-filling in the values of some controls on the form.

i tried setting my current Request.Form data:

if (theyWantToDoSomething)
{
   //pre-fill form values
   context.Request.Form["TextBox1"] = "test";
   context.Request.Form["ComboBox1"] = "test 2";
   context.Request.Form["TextBox2"] = GetTheTextForTheThing();

   //tell the client to go there
   context.Response.Redirect("~/SomeWebForm.aspx");
   return;        
}

But i get an exception that Form values are read only.

What would be a way to send the client to another page, pre-filling form data?


Answer

i used the Session state to store values. It’s important to note that by default a Handler doesn’t have access to Session (the Session object will be null). You have to tell IIS to give you the Session object by adding the IRequiresSessionState marker interface to your handler class:

public class Handler : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
   public void ProcessRequest(HttpContext context)
   {
      ...
      if (theyWantToDoSomething)
      {
         //pre-fill form values
         context.Session["thing1"] = "test";
         context.Session["thing2"] = "test 2";
         context.Session["thing3"] = GetTheTextForTheThing();

         //tell the client to go there
         context.Response.Redirect("~/SomeWebForm.aspx");
         return; //not strictly needed, since Redirect ends processing
      }
      ...
   }
}
  • 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-11T23:44:54+00:00Added an answer on May 11, 2026 at 11:44 pm

    You can only populate your Response, the Request is input data and is indeed read-only.

    If you are using ASP.NET, there are a variety of ways you could accomplish what you need:

    • The best way would probably be to pass the data you need to be pre-populated to SomeWebForm.aspx via the Session object, and on that pages Load method, populate your form. Keep in mind that when you do Response.Redirect, a 302 response is sent to the client with the URL the client should redirect to. The process is transparent to the user…but there is a full round trip involved.

    • Another alternative to populating the users Session would be to add GET parameters via a query string to the redirect to SomeWebForm.aspx.

    • If you need to transfer processing to the SomeWebForm.aspx page without round tripping, you could use Server.Transfer. This will transfer execution from the current page to the page you choose…however, this can cause some odd behavior on the client end because the URL does not update. As far as the user is concerned, it will still appear as though they are on the same page they started on.

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

Sidebar

Related Questions

I want to ask,i tried to call webapp.RequestHandler ,but this handler didn't called: this
So, what I want is basically to attach a javascript handler to a form,
I have some web pages I want people to be logged in to see.
I tried some work using http handler and found that we can not execute
In my Application_Error event handler i want to render an MVC-View for 404. I
I want to add an event handler to a paragraph for when any user
Why would I want to get out of an Error Handler (after handling) with
I want to know what is the best solution for creating ASP.NET HTTP Handler
I have an keyup handler. I want something to happen every time I press
I have form object that I set to request in GET request handler in

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.