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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:30:05+00:00 2026-06-06T13:30:05+00:00

Imagine a page with a form input: Search Criteria: crackers                   From: ian@stackoverflow.com           To: list@stackoverflow.com      

  • 0

Imagine a page with a form input:

Search Criteria: crackers                  


From: ian@stackoverflow.com          
To: list@stackoverflow.com      
Subject: How to maintain form state with PRG?
Message: Imagine a page with form input:              
 
 
 
 
 

Send

After the user clicks Send, the server will instruct to client to Redirect, as part of the Post-Redirect-Get pattern.

POST /mail/u/compose

HTTP/1.1 303 See Other
Location: https://stackoverflow.com/mail/u/compose

And the client will issue a GET of the new page. The problem is that some elements of the existing form are lost:

Search Criteria:                   

It gets worse when there are a few drop-downs, and checkboxes.

How can i maintain form state in using Post-Redirect-Get in ASP.net, given that the viewstate is then non-existent.


Bonus Reading

  • ASP.NET: How to redirect, prefilling form data?
  • 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-06T13:30:07+00:00Added an answer on June 6, 2026 at 1:30 pm

    If the search criteria value is supposed to persist across many different pages in the system (in other words, throughout the user’s session), it sounds like a candidate to be stored in the Session. Or, if it is supposed to persist across multiple sessions (ie, next time the user logs in, it remembers the search criteria he used last time), it will need to be persisted somewhere more permanent.

    I’m not aware of anything in ASP.NET which behaves like MVC’s “temp” space, where the value is automatically cleaned up on first read. Though of course, a helper class (or convenience function) which wraps the Session could perform that sort of “read-once” functionality.

    Finally, you could pass the search criteria as a URL parameter when you re-direct. However, that’s a little cumbersome (especially if you have multiple fields), and you need to sanitize the incoming data.

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

Sidebar

Related Questions

Imagine this simple form for uploading a file: <form action=upload enctype=multipart/form-data> <input type=text name=name/>
I currently have a page with four list boxes on it and imagine a
I have the folowing gsp page: <g:form controller=?? action=??> <h1>Search</h1> <g:submitButton name=search value=Search/> <div
The facebook home page (http://www.facebook.com/) has an login form on it. It does not
The idea is very simple: Imagine a simple white page with a form with
Imagine we have a page with a form where users can create their own
Imagine that HTML page is a game surface (see picture). User can have n
Imagine the scenario you have a listing page that is a concatenation of multiple
Imagine I have a navigation bar in my page header, with a number of
I have a vertically scrolling uiscrollview - imagine an 'about this app' page of

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.