473,791 Members | 3,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mixing GET and POST generates inconsistence in URLS...

Hi to all,
I have an aesthetic problem to solve. I'm working on the managing part
of a site. Some pages can be called with a query string like this:
http://mysite.com/manage.aspx?code=300

The manage.aspx web form uses the view state, has some web controls that can
cause post back and so on: it's a classic POST web form. In that page
there's a navigation control that changes (virtually) the query string.
Virtually means that the query string is not actually changed but the web
form behaves as the query string was changed. Suppose that with the
manage.aspx you can manage a product: you can modify the product name, the
product description or you can navigate to a different product and manage
that different product maintaining the state of the page. All that can be
done by POST and not by GET. But initially the page has been called by using
a GET... and the query string remains "cross posting". In other words the
first call is made as above and the next posts could be related to different
products so the query string should disappear... But it remains there
creating the URL inconsistency that hurts me so much!

Is there anyone having a solution for my problem?

Thanks,
Gabriele
Nov 18 '05 #1
1 1714
You're right. The structure of my pages is as you said, the problem is
another.

The first time I call a page there are some params in the query string like:
http://mysite.com/manage.aspx?code=300
I press a button on the page that causes a postback; after the roundtrip the
url in the browser contains the same query string
(http://mysite.com/manage.aspx?code=300) but it's no more significant
because that "code" value should have been changed during the postback. So,
what I want is to have, after the postback, my browser connected to
http://mysite.com/manage.aspx. Is that a bad idea?

Thank you for your response,
Gabriele

"Cowboy (Gregory A. Beamer) - MVP" <No************ @comcast.netNoS pamM> wrote
in message news:B2******** *************** ***********@mic rosoft.com...
In most cases, the issue is how Page_Load is used. As an event, Page_Load is an even to "Load a Page". I know this sounds "well, duh"-ish, but so many
people have code like so:

Page_Load()
{
if(!Page.IsPost back)
{
//Tons of Code here
}
else
{
//Tons of other code here
}
}

This is problematic, as the Page_Load is now handling part of the logic for the postback events. For me, the first rule is Page_Load only loads the page ... period. Any POST event is handled by its event handler.

If you follow this, Page_Load can easily handle QueryString args, like so:

Page_Load()
{
if(!Page.IsPost back)
{
string qsArg = Request.QuerySt ring("X");

if(qsArg!=Strin g.Empty)
{
//This is set up from QS arg
}
else
{
//This is a raw form, with no QS arg
}
}
else
{
//No else, unless you have code that applies
//to EVERY postback
}
}

Hope this helps.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** ************
Think Outside the Box!
*************** ************

"Gabriele Zannoni" wrote:
Hi to all,
I have an aesthetic problem to solve. I'm working on the managing part of a site. Some pages can be called with a query string like this:
http://mysite.com/manage.aspx?code=300

The manage.aspx web form uses the view state, has some web controls that can cause post back and so on: it's a classic POST web form. In that page
there's a navigation control that changes (virtually) the query string.
Virtually means that the query string is not actually changed but the web form behaves as the query string was changed. Suppose that with the
manage.aspx you can manage a product: you can modify the product name, the product description or you can navigate to a different product and manage that different product maintaining the state of the page. All that can be done by POST and not by GET. But initially the page has been called by using a GET... and the query string remains "cross posting". In other words the first call is made as above and the next posts could be related to different products so the query string should disappear... But it remains there
creating the URL inconsistency that hurts me so much!

Is there anyone having a solution for my problem?

Thanks,
Gabriele

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1959
by: Dave | last post by:
Hi folks, I seem to be using these newsgroups a good bit and probabely will be for the next three or so months. I wonder if there is a workaround to a problem I'm having. PHP always says that variables are undefined for the first time I visit a page. I have register_globals on and on the second visit a page when a certain post variable 'has' a value and been defined. Here's a bit of code I'm working with now.
0
1830
by: Erik Max Francis | last post by:
Is there any prohibition against mixing different protocols within the same pickle? I don't see anything about this in the Python Library Reference and, after all, the pickle.dump function takes a protocol argument for each time it's called. (This is in Python 2.3.3.) I have a pickle containing two objects: a tag string and a (large) object containing many children. The identifying string is there so that you can unpickle it and...
7
29937
by: Eric | last post by:
I am certain the answer will be 'NO', but I wanted to ask anyway just incase I have missed something. Everyone knows that one pass data to a page in an anchor tag by using the GET Method: <a href="http://www.aaa.com/randompage.php?name=data"> What I am wondering is if there was a way to do the same thing, but use the POST Method instead...?
16
2074
by: Shelly | last post by:
(posted previously on comp.lang.php but no response received. Cross-posted in the dreamweaver forum) I am confused about what goes on with method POST. Here is an overview of a my code, sketching it out: <?php if (isset($_POST) && $_POST=="Submit") { ---Do a bunch of stuff--- if (isset($_SESSION)) unset($_SESSION);
7
2671
by: Ubantu Rococo | last post by:
Hi all, Sorry for this stupid question, but I am having trouble mixing imagecopy etc. with HTML. What I am trying to do is copy an image, and then obtain co-ordinates from a database which will then be drawn on the image (to create a clickable imagemap). The image will then be displayed as part of a webpage. I've included my code snippet below. It doesn't work, and I think I know why - the output on my screen
1
2438
by: Vladimir Shiryaev | last post by:
Hello! Exception handling in generics seems to be a bit inconsistent to me. Imagine, I have "MyOwnException" class derived from "ApplicationException". I also have two classes "ThrowInConstructor" and "ThrowInFoo". First one throws "MyOwnException" in constructor, second one in "Foo()" method. There is a "GenericCatch" generics class able to accept "ThrowInConstructor" and "ThrowInFoo" as type parameter "<T>". There are two methods in...
10
2218
by: Trammel | last post by:
Hi, Im just about to start developing a new website for personal / friend use that may be accessed by other people all over the web. I was sitting thinking through designs for the pages, etc when I came across a thought.... ....why show the visitor loads of junk just because Im using A-href type links? Is there a way to create a text-link that will request a page using POST instead of GET?
4
1955
by: Chris | last post by:
I have a web page that I want to automate a post to. I would use the web request. However the post involves a file upload. What would be the best way of doing this? Regards, Chris.
8
2401
by: Kurda Yon | last post by:
Hi, I have to decide which form-method I should use (GET or POST). I found the following recomendation: If the service associated with the processing of a form has side effects (for example, modification of a database or subscription to a service), the method should be POST. (http://www.cs.tut.fi/~jkorpela/ forms/methods.html). However, later I did not find any convinced arguments why it should
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10207
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10156
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9997
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5435
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.