troubleshooting Question

Use QueryString to initiate page, use form POST after

Avatar of Jahelka
JahelkaFlag for United States of America asked on
ASP.NETWeb Applications
6 Comments2 Solutions675 ViewsLast Modified:
Hello Experts:

Using ASP.net 2.0...  Making transition from classic ASP to ASP.net/VB

I've got an existing classic ASP page that uses form GET/QueryString.  It works great as there are only a few criteria that the page really needs to be able to change the view of a dynamic page that shows database reports.  I am porting this page over to ASP.net and am struggling with the best way to use the new features of ASP.net (and follow ASP.net "best practices"), while maintaining some of the nice features of the existing classic ASP page.

One of the nice things about the classic ASP page, after a user selected the criteria they wanted for their report (and got the "view" they wanted, they could easily copy the URL and share it or post it somewhere (all the criteria for the report was in the URL).  With ASP.net, and all the "pre-wired" stuff, there is a bunch of extra stuff that shows up in the query string, and it certainly isn't as nice to share.  So I think I would like to use POST with this new ASP.net page.  My thought was, I could provide a link (with QueryString) somewhere on the page, and tell the user if they want to share this particular "report view" with someone else, they can copy the provided link and use that.  My idea was, the page would first check the querystring for "page initialization" to set the initial criteria, then use POST after that to exchange information between postbacks.

Problem:  Once someone navigates to the ASP.net page using this query string, the query string doesn't go away after the first postback.  Two problems with this...  I can't figure out whether I'm supposed to be pulling my criteria from the query string to "initialize" or if I should be using the POST form data (I suppose I could with IsPostback).  More importantly, the URL and QueryString doesn't change, but the actual criteria being used for the report DOES change with each postback, and that isn't reflected in the URL, so confusion could easily arise from this.

Maybe I am trying to solve this problem the wrong way and there is a better way to do it.  If you know of a better way, let me know.  But I suppose to solve my immediate problem with the way I'm trying to do it, I would need to know how to clear the querystring as shown in the user's address bar on a post back.
ASKER CERTIFIED SOLUTION
Muhammad Ousama Ghazali
Solution Analyst & Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros