473,508 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

querystring pros and cons, help?

Hi folks,
I'm having a discussion with my colleague about how to go about passing data
from one aspx page to another
example
On the main page I have a whole list of relationship managers with a
hyperlink that says 'customers' in each row for each manager and the
hyperlink contains a parameter for that manager and when the 'customers' page
is opened it checks that parameter via its querystring property

is this a bad thing to do?

is there a more generally well regarding method of passing the ID of that
manager to the 'Customers.aspx' page

I think that querystrings are a perfectly respectable way to do this, my
colleague thinks that it will be slow and inelegant (and is mentioning things
such as server.transfer, server.redirect, which I don' t think are to do with
this kind of typical scenario)

any suggestions would be welcome!

thanks in advance for your help
CharlesA
Jan 12 '06 #1
5 2418
I believe a querystring parameter is OK for this scenario. Make sure you take
malicious use of the querystring into account, I normally encrypt these
parameters and give them meaningless names like p1 rather tha ManagerID

HTH

David

"CharlesA" wrote:
Hi folks,
I'm having a discussion with my colleague about how to go about passing data
from one aspx page to another
example
On the main page I have a whole list of relationship managers with a
hyperlink that says 'customers' in each row for each manager and the
hyperlink contains a parameter for that manager and when the 'customers' page
is opened it checks that parameter via its querystring property

is this a bad thing to do?

is there a more generally well regarding method of passing the ID of that
manager to the 'Customers.aspx' page

I think that querystrings are a perfectly respectable way to do this, my
colleague thinks that it will be slow and inelegant (and is mentioning things
such as server.transfer, server.redirect, which I don' t think are to do with
this kind of typical scenario)

any suggestions would be welcome!

thanks in advance for your help
CharlesA

Jan 12 '06 #2
The biggest problem with a querystring value is security, both in the sense
that it can't be used to pass secure information around and it can be
tampered. What if you don't want anyone to be able to put any ID in the
querystring? Of course, chances are you'd have a check on customer.aspx for
that anyways.

i think your colleague is dead wrong about performance. Querystrings tend to
be the most performant (did you know that isn't actually a word?) solutions.

With a querystring you have a link that goes to a different page
customer.aspx?id=3 It will result in a typical GET, RESPONSE scenario.

To get server.transfer going, you are going to need to postback to the page
you are currently on and do the server.transfer. The postback itself is a
GET, RESPONSE and the server.transfer happens internally. The net result is
that this mechanism is the exact same for the client (oh, except they can't
bookmark the page they are now on), but on the server you've now had 2
init's, loads, 1 loadviewstate and rebuilt all the controls of the first
page just to hook into the event.

Sometimes you need to postback, say to finish some tasks before "leaving"
the page. Sometimes the power of storing values in the HttpContext and doing
a Transfer is absolutely necessary. But from the simple case you've
described, security concerns aside, querystring all the way.

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"CharlesA" <Ch******@discussions.microsoft.com> wrote in message
news:E7**********************************@microsof t.com...
Hi folks,
I'm having a discussion with my colleague about how to go about passing
data
from one aspx page to another
example
On the main page I have a whole list of relationship managers with a
hyperlink that says 'customers' in each row for each manager and the
hyperlink contains a parameter for that manager and when the 'customers'
page
is opened it checks that parameter via its querystring property

is this a bad thing to do?

is there a more generally well regarding method of passing the ID of that
manager to the 'Customers.aspx' page

I think that querystrings are a perfectly respectable way to do this, my
colleague thinks that it will be slow and inelegant (and is mentioning
things
such as server.transfer, server.redirect, which I don' t think are to do
with
this kind of typical scenario)

any suggestions would be welcome!

thanks in advance for your help
CharlesA

Jan 12 '06 #3
I find a bit of this misleading.

Session variables aren't associated to size of data ("larger pieces"), but
rather time to live. They live throughout the entire visit, not a single
request. You don't use a session because there's a lot of data, you use it
'cuz you need it alive for the duration of the visit. Personally, I woudln't
even use it there, as it pins it in memory, I'd store it in the cache with a
userId key.

I think what you mean by Context Cache is actually the Context Items
collection. I only point that out because I think when most people hear
"cache" they think of the Cache object (which is available via the context,
Context.Cache).

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Spam Catcher" <sp**********@rogers.com> wrote in message
news:Xn**********************************@127.0.0. 1...
"=?Utf-8?B?Q2hhcmxlc0E=?=" <Ch******@discussions.microsoft.com> wrote in
news:E7**********************************@microsof t.com:
I think that querystrings are a perfectly respectable way to do this,
my colleague thinks that it will be slow and inelegant (and is
mentioning things such as server.transfer, server.redirect, which I
don' t think are to do with this kind of typical scenario)


There are a couple ways to pass data between pages in ASP.NET:

Session Variables
Context Cache Variables
Querystring Variables
Cookies

Here's what I think:

Querystring are simple and allow bookmarking of the page.

Session Variables should be used to transfer larger pieces of data (i.e.
object data).

Context Cache variables is another option. They allow passing of data
between pages for 1 request (afterwards the context cache is cleared).
However, Context cache variables must use Server.Transfer. While
Server.Transfer technically is more efficent than a Reponse.Redirect, the
end user does not see the page address change - thus the end user cannot
bookmark the page.

In your situation, I agree with you... Query Strings are nice and simple,
unless you're passing a bunch of data.

--
Stan Kee (sp**********@rogers.com)

Jan 12 '06 #4
Thanks everyone for your speedy and helpful posts
much appreciated, especially the breadth and as I say again the speed with
which you all answered!

many thanks
CharlesA

to Karl, I didn't know that 'perfomant' wasn't a word, I've been using it
ever since I went to an incredibly interesting lecture by Ingo Rammer in
which he said that business objects are way more 'performant' than Datasets
in remoting scenarios...

Jan 12 '06 #5
That's ironic, I think I first found out when writing my article on business
objects vs datasets for MSDN :) My girlfriend poitned it out (she's my
first editor) and I had to rewrite some stuff because of her. I've since
reverted to using it!

http://msdn.microsoft.com/asp.net/de...CustEntCls.asp

Some trace it to the french word spelt the same meaning "efficient"

--
MY ASP.Net tutorials
http://www.openmymind.net/
"CharlesA" <Ch******@discussions.microsoft.com> wrote in message
news:EC**********************************@microsof t.com...
Thanks everyone for your speedy and helpful posts
much appreciated, especially the breadth and as I say again the speed with
which you all answered!

many thanks
CharlesA

to Karl, I didn't know that 'perfomant' wasn't a word, I've been using it
ever since I went to an incredibly interesting lecture by Ingo Rammer in
which he said that business objects are way more 'performant' than
Datasets
in remoting scenarios...

Jan 12 '06 #6

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

Similar topics

1
2019
by: Ronnie Patton | last post by:
Hello everyone can you help me find some information out about pros and cons using a global.asa in any asp application My co-works are saying its your choice to use one or not based on what the...
112
10219
by: Andy | last post by:
Hi All! We are doing new development for SQL Server 2000 and also moving from SQL 7.0 to SQL Server 2000. What are cons and pros for using IDENTITY property as PK in SQL SERVER 2000? Please,...
0
1300
by: John Doe | last post by:
I have been given the task of figuring out if it would be better to purchase or develop a new system to replace the existing legacy unix system that is current in place. I am trying to do this as...
5
7608
by: Fred | last post by:
Not much expertise on XSLT and trying to understand it's uses when creating apps in VS.NET? If I wanted flexibility on the UI (View aspect of M.V.C.): - How does it compare with creating...
2
2793
by: scott | last post by:
Hi, Just wondering what sort of problems and advantages people have found using stored procedures. I have an app developed in VB6 & VB.NET and our developers are starting to re-write some of the...
3
4208
by: Andrea | last post by:
Hello everyone, I'd like to know which are the main pros and cons of using XML implementation in business organizations. >From a technical perspective, I find XML powerful, but looks like it is...
3
19649
by: mcyi2mr3 | last post by:
can anyone explain to me what the pros and cons are of creating indexes on mysql tables. do they increase query speed? and if so at what cost? im thinking of using them for a large table i have...
8
3357
by: dbarker1 | last post by:
This may be a can of worms but I wanted to throw it out here. I am gathering pros and cons for using querystring vs session variables for passing row keys in a ASP.net application. I want to be...
7
3099
by: archimonde2 | last post by:
What are pros any cons to use eaccelerator and zend optimizer on php5-mod with apache2.2 ?? Does accelerators work immediately after install on all php files? When both are in use which...
0
7336
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,...
0
7401
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...
1
7063
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...
0
7504
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...
0
5640
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5059
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...
0
4720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3211
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...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.