473,378 Members | 1,438 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Context or URL ?

Hi,

Is it better to use the URL method to send informations to a page, or to use
the context method ?

Thanks.
Nov 19 '05 #1
8 1634
WJ
If the caller is of "Page" class, then Response.Redirect("url.aspx",..)
would be more than enough. If the caller is not of class "Page", then you
have to use HttpContext.

John

"Steph" <no_spam@no_spam.org> wrote in message
news:uN****************@TK2MSFTNGP15.phx.gbl...
Hi,

Is it better to use the URL method to send informations to a page, or to
use
the context method ?

Thanks.

Nov 19 '05 #2
I don't understand this question. You'd use the QueryString (what I think
you mean by "URL Method") and the HttpContext for very different
situations. Accross requests you can't use HttpContext, within a request
you can't use Querystring....

Perhaps this article would help:
http://openmymind.net/index.aspx?documentId=6

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Steph" <no_spam@no_spam.org> wrote in message
news:uN****************@TK2MSFTNGP15.phx.gbl...
Hi,

Is it better to use the URL method to send informations to a page, or to use the context method ?

Thanks.

Nov 19 '05 #3
Ok, my question was not so clear...
I have page1 and page2
Is it better to use in page2:
A/ Request.Querystring
B/ page1 mypage = (page1)Context.handler
label1.text = page1.Name
(In page1 i have a Name property with a get (readonly)...)

Thanks.

Nov 19 '05 #4
Steph:

You can't have Page1 and Page2 loaded at the same time

where are these being used? where are you doing (page1)Context.handler
from? From a user control? Some class?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Steph" <no_spam@no_spam.org> wrote in message
news:eN**************@tk2msftngp13.phx.gbl...
Ok, my question was not so clear...
I have page1 and page2
Is it better to use in page2:
A/ Request.Querystring
B/ page1 mypage = (page1)Context.handler
label1.text = page1.Name
(In page1 i have a Name property with a get (readonly)...)

Thanks.

Nov 19 '05 #5
Ok, let's try something different...

I have a submit form on page1 and want to reach page2 and retreive the
values.
To do this, i have several methods (cache, shared variable, session
variable...) but i am focused on these:

* page1: on the button1 clic method for ex, i have
Response.Redirect["page2.aspx?id=45"] and on page2 i have label1.text =
Request.Querystring["id"]

* page1 : i create a property (id for ex...) with a get (do not need a set
of course...) and on the button1 clic method i have a
Server.Transfer("page2.aspx")
And on page2 i have:
page1 mypage = (page1)Context.handler
label1.text = page1.id

These two solutions both works. But i need to know if there is one better
than the other...

Is it more clear ?!

Thanks for taking time.
Nov 19 '05 #6
It's crystal clear :) Sorry, but without context it's difficult to
understand...

Each method has advantages and disadvantages:

Method 1 can be bookmarked, but it has ugly paths and puts an extra hit on
the client/server

Method 2 can't be bookmarked, but it's much prettier and more efficient

If you don't need to bookmark, I'd go with method 2.

I'd also improve it...instead of using Context.Handler, I'd store the values
in Context.Items and then retrieve them from Context.Items. Using
(page1)Context.Handler effectively binds Page2 to Page1 which should be
avoided if possible (which you can via Context.Items)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Steph" <no_spam@no_spam.org> wrote in message
news:uv**************@TK2MSFTNGP14.phx.gbl...
Ok, let's try something different...

I have a submit form on page1 and want to reach page2 and retreive the
values.
To do this, i have several methods (cache, shared variable, session
variable...) but i am focused on these:

* page1: on the button1 clic method for ex, i have
Response.Redirect["page2.aspx?id=45"] and on page2 i have label1.text =
Request.Querystring["id"]

* page1 : i create a property (id for ex...) with a get (do not need a set
of course...) and on the button1 clic method i have a
Server.Transfer("page2.aspx")
And on page2 i have:
page1 mypage = (page1)Context.handler
label1.text = page1.id

These two solutions both works. But i need to know if there is one better
than the other...

Is it more clear ?!

Thanks for taking time.

Nov 19 '05 #7
Ok, that's it !!
Thanks for answering.

But if you use Context.items, it's pretty like using Session variables no ?
And then, this may take a large amount of server memory, don't you think ?
Nov 19 '05 #8
Context.Item IS stored in memory, but only for the lifetime of a single
request...unlike session variables which are stored for the lifetime of a
user visit...as such they do share similarities, but I doubt you'll run into
any problems.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Steph" <no_spam@no_spam.org> wrote in message
news:Om**************@TK2MSFTNGP14.phx.gbl...
Ok, that's it !!
Thanks for answering.

But if you use Context.items, it's pretty like using Session variables no ? And then, this may take a large amount of server memory, don't you think ?

Nov 19 '05 #9

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

Similar topics

1
by: SPG | last post by:
Hi, I am relatively new to TOMCAT, and am trying to deploy a web app using it. I have a domain name that I want to use to access my web app directly. By default, I deploy my WAR, and it deploys...
2
by: Eliza Zadura | last post by:
The following question is about XPath and context, as I am not sure I'm grasping the concept entirely and this is causing me some problems while working on my XSL transformation. I have checked...
4
by: Mohit Gupta | last post by:
Hi all, Lately I have been working on an application in VB .net CF for Pocket PC device. I have a small question about Context Menu. When I try to close the window after context menu is poped...
5
by: Nadav | last post by:
Hi, I am using FileStream's Async API: BeginRead/EndRead, upon completion callback execution I use the read data and call EndRead, Taking that in mind, I Wonder... does calling EndRead will cause...
5
by: Dean L. Howen | last post by:
Dear friends, Could we determine when context menu should appear?
8
by: Dennis C. Drumm | last post by:
Is there a way to modify the standard context menu shown when someone right clicks in a windows text box and that would work for all open windows applications? The standard context menu for...
2
by: dave | last post by:
This little problem is driving me nuts!! On my webform page I create 2 variables.. Protected p_dml As String = "I" Public Const mwv_id As Integer = 0 ' originally had mwv_id as Protected
1
by: goRide | last post by:
Hi, I'm looking of a way (preferred - a ready class or dll) to customize the context menu. many application has more controls inside the context menu (like textbox, sliders, checkbox, panel...
4
by: Andrus | last post by:
For winforms application with multiple related forms it is reasonable to create Linq database context object in start of application. Context object is released only when application exits. So...
4
by: AAaron123 | last post by:
trying to understand the below shown code. After this is run the browser opens a file-save dialog box for saving the file. I wonder how it knows I want the file saved? But more important, the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.