473,322 Members | 1,755 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,322 software developers and data experts.

post variables from 1 page to another

When I transfer variables from 1 page to another I add the variables in the
querystring.
So, in the script of my asp-button I put for ex.:

response.redirect("thenewpage.aspx?myvar=<%= thevariable %>")

problem is that these variables are ofcourse visible in the url

So, what is the best and easiest way to transfer variables from one
aspx-page to another?
(Through a button, as in the example, or with a link.)

THX for help.

Nov 19 '05 #1
2 1280
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetbips.com/displayarticle.aspx?id=79

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"nicholas" <mu********@hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP10.phx.gbl...
When I transfer variables from 1 page to another I add the variables in
the
querystring.
So, in the script of my asp-button I put for ex.:

response.redirect("thenewpage.aspx?myvar=<%= thevariable %>")

problem is that these variables are ofcourse visible in the url

So, what is the best and easiest way to transfer variables from one
aspx-page to another?
(Through a button, as in the example, or with a link.)

THX for help.

Nov 19 '05 #2
thx a lot. very helpful !

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:e9**************@TK2MSFTNGP14.phx.gbl...
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc. You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/is...e/default.aspx
http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetbips.com/displayarticle.aspx?id=79

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"nicholas" <mu********@hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP10.phx.gbl...
When I transfer variables from 1 page to another I add the variables in
the
querystring.
So, in the script of my asp-button I put for ex.:

response.redirect("thenewpage.aspx?myvar=<%= thevariable %>")

problem is that these variables are ofcourse visible in the url

So, what is the best and easiest way to transfer variables from one
aspx-page to another?
(Through a button, as in the example, or with a link.)

THX for help.


Nov 19 '05 #3

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

Similar topics

3
by: Bernd Kohler | last post by:
Hello, I got an annoying problem using the POST-method to send a form's data: I put a login-form on the page which is sent by the POST-method to itself. After that the content of the...
2
by: luu duong | last post by:
I know this is probably easy but here is the details. I have an asp page that is not inside a frameset. I want to post data to another asp page that is inside a frameset. So firstpage.asp has...
2
by: Asp Help | last post by:
I'm working on a ASP applicatition to create Windows 2000 users. Because I don't want everybody to have access to the site I've changed te security in IIS 5.0 which runs on a windows 2000 Sp4...
6
by: Phillip N Rounds | last post by:
I have a webform, from which I have to submit info to another site. Their instructions are to have a html form, with the following as the submit: <form method="post"...
2
by: Deb M. | last post by:
I am trying to find out how I can use the ASP.net framework yet still post the variables to an external script (not ASPX) after the form has been submitted. So, the ASPX page will still post to...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
24
by: moriman | last post by:
Hi, The script below *used* to work. I have only just set up a server, PHP etc again on my Win98 system and now it doesn't? On first loading this page, you would have $p = and the button...
3
by: Leo | last post by:
Can anyone help or offer some explanation with this problem: I'm trying to do a POST from one of my PHP pages, to another page on my site using curl. To maintain the session I'm sending the...
4
by: paulmitchell507 | last post by:
I have a simple SQL query that is run inside a asp page. I would normally display the results using the response.write("my name is: " & name) if I wanted the output displayed. On this occasion I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.