473,398 Members | 2,165 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,398 software developers and data experts.

Pass an additionnal HTTP parameter while using Server.Transfer

Hi all,

I have an "EditeItem.aspx" page which lets me edit properties of an "Item".
In the OnClick() event of my Save button, I do save Item changes to the
database and then I redirect the user to the Item page "ViewItem.aspx" with
a simple :

Server.Transfer("ViewItem.aspx");

I'd like to pass another HTTP parameter so that in the "ViewItem.aspx" page,
I am able to know that the user comes from the "EditItem.aspx". Here's what
I'd like to do :

Request.QueryString.Add("RefreshMenu", "1"); // <-- Raises an
exception
Server.Transfer("ViewItem.aspx");

Indeed, QueryString (or Form, or Params) are read-only collection and
therefore, it raises an exception. How can I pass an addtionnal HTTP
parameter ?

Thanks in advance !

Julien C.
Nov 18 '05 #1
5 7794
Seb
Hi Julien,

Server.Transfer("ViewItem.aspx?source=EditItem.asp x");

Cheers
Seb
-----Original Message-----
Hi all,

I have an "EditeItem.aspx" page which lets me edit properties of an "Item".In the OnClick() event of my Save button, I do save Item changes to thedatabase and then I redirect the user to the Item page "ViewItem.aspx" witha simple :

Server.Transfer("ViewItem.aspx");

I'd like to pass another HTTP parameter so that in the "ViewItem.aspx" page,I am able to know that the user comes from the "EditItem.aspx". Here's whatI'd like to do :

Request.QueryString.Add("RefreshMenu", "1"); // <-- Raises anexception
Server.Transfer("ViewItem.aspx");

Indeed, QueryString (or Form, or Params) are read-only collection andtherefore, it raises an exception. How can I pass an addtionnal HTTPparameter ?

Thanks in advance !

Julien C.
.

Nov 18 '05 #2
Hi Seb,

I already tried and it doesn't work !
Thanks anyway !

Julien C.

"Seb" <an*******@discussions.microsoft.com> a écrit dans le message de
news:06****************************@phx.gbl...
Hi Julien,

Server.Transfer("ViewItem.aspx?source=EditItem.asp x");

Cheers
Seb
-----Original Message-----
Hi all,

I have an "EditeItem.aspx" page which lets me edit

properties of an "Item".
In the OnClick() event of my Save button, I do save Item

changes to the
database and then I redirect the user to the Item

page "ViewItem.aspx" with
a simple :

Server.Transfer("ViewItem.aspx");

I'd like to pass another HTTP parameter so that in

the "ViewItem.aspx" page,
I am able to know that the user comes from

the "EditItem.aspx". Here's what
I'd like to do :

Request.QueryString.Add("RefreshMenu", "1"); //

<-- Raises an
exception
Server.Transfer("ViewItem.aspx");

Indeed, QueryString (or Form, or Params) are read-only

collection and
therefore, it raises an exception. How can I pass an

addtionnal HTTP
parameter ?

Thanks in advance !

Julien C.
.

Nov 18 '05 #3
Should work!

How do you read the parameter?
string source = Request.Params["source"];

If not ok:
try
Response.Redirect(url);
instead of
Server.Transfer(url);
Seb
-----Original Message-----
Hi Seb,

I already tried and it doesn't work !
Thanks anyway !

Julien C.

"Seb" <an*******@discussions.microsoft.com> a écrit dans le message denews:06****************************@phx.gbl...
Hi Julien,

Server.Transfer("ViewItem.aspx?source=EditItem.asp x");

Cheers
Seb
>-----Original Message-----
>Hi all,
>
>I have an "EditeItem.aspx" page which lets me edit

properties of an "Item".
>In the OnClick() event of my Save button, I do save
Item changes to the
>database and then I redirect the user to the Item

page "ViewItem.aspx" with
>a simple :
>
> Server.Transfer("ViewItem.aspx");
>
>I'd like to pass another HTTP parameter so that in

the "ViewItem.aspx" page,
>I am able to know that the user comes from

the "EditItem.aspx". Here's what
>I'd like to do :
>
> Request.QueryString.Add
("RefreshMenu", "1"); // <-- Raises an
>exception
> Server.Transfer("ViewItem.aspx");
>
>Indeed, QueryString (or Form, or Params) are read-only

collection and
>therefore, it raises an exception. How can I pass an

addtionnal HTTP
>parameter ?
>
>Thanks in advance !
>
>Julien C.
>
>
>.
>

.

Nov 18 '05 #4
Yep,

I read the parameter with : string source = Request.Params["source"];

I don't want to use Response.Redirect() since it involves another roundtrip.
The interest of Server.Transfer() was that it happens entirely on the
server.

I'd really like to do this using Server.Transfer()

Julien C.

<an*******@discussions.microsoft.com> a écrit dans le message de
news:07****************************@phx.gbl...
Should work!

How do you read the parameter?
string source = Request.Params["source"];

If not ok:
try
Response.Redirect(url);
instead of
Server.Transfer(url);
Seb
-----Original Message-----
Hi Seb,

I already tried and it doesn't work !
Thanks anyway !

Julien C.

"Seb" <an*******@discussions.microsoft.com> a écrit dans le message denews:06****************************@phx.gbl...
Hi Julien,

Server.Transfer("ViewItem.aspx?source=EditItem.asp x");

Cheers
Seb
>-----Original Message-----
>Hi all,
>
>I have an "EditeItem.aspx" page which lets me edit

properties of an "Item".
>In the OnClick() event of my Save button, I do save
Item changes to the
>database and then I redirect the user to the Item

page "ViewItem.aspx" with
>a simple :
>
> Server.Transfer("ViewItem.aspx");
>
>I'd like to pass another HTTP parameter so that in

the "ViewItem.aspx" page,
>I am able to know that the user comes from

the "EditItem.aspx". Here's what
>I'd like to do :
>
> Request.QueryString.Add
("RefreshMenu", "1"); // <-- Raises an
>exception
> Server.Transfer("ViewItem.aspx");
>
>Indeed, QueryString (or Form, or Params) are read-only

collection and
>therefore, it raises an exception. How can I pass an

addtionnal HTTP
>parameter ?
>
>Thanks in advance !
>
>Julien C.
>
>
>.
>

.

Nov 18 '05 #5
You could use a session variable.

In this particular case, I would still use Response.Redirect as you want to
say to the browser to point to another location (with Server.Transfer the
browser will still show the "old" URL).

IMO, Server.Transfer is rather for those who have processing only pages. It
allows then to transfer the control to a processing only page easily server
side, before perhaps a final redirect to let the browser point to anotehr
final web page (rather than to have several redirects).

Patrice

--

"Julien C." <ch******@hotmail.com> a écrit dans le message de
news:et**************@tk2msftngp13.phx.gbl...
Yep,

I read the parameter with : string source = Request.Params["source"];

I don't want to use Response.Redirect() since it involves another roundtrip. The interest of Server.Transfer() was that it happens entirely on the
server.

I'd really like to do this using Server.Transfer()

Julien C.

<an*******@discussions.microsoft.com> a écrit dans le message de
news:07****************************@phx.gbl...
Should work!

How do you read the parameter?
string source = Request.Params["source"];

If not ok:
try
Response.Redirect(url);
instead of
Server.Transfer(url);
Seb
-----Original Message-----
Hi Seb,

I already tried and it doesn't work !
Thanks anyway !

Julien C.

"Seb" <an*******@discussions.microsoft.com> a écrit dans

le message de
news:06****************************@phx.gbl...
Hi Julien,

Server.Transfer("ViewItem.aspx?source=EditItem.asp x");

Cheers
Seb
>-----Original Message-----
>Hi all,
>
>I have an "EditeItem.aspx" page which lets me edit
properties of an "Item".
>In the OnClick() event of my Save button, I do save Item changes to the
>database and then I redirect the user to the Item
page "ViewItem.aspx" with
>a simple :
>
> Server.Transfer("ViewItem.aspx");
>
>I'd like to pass another HTTP parameter so that in
the "ViewItem.aspx" page,
>I am able to know that the user comes from
the "EditItem.aspx". Here's what
>I'd like to do :
>
> Request.QueryString.Add ("RefreshMenu", "1"); // <-- Raises an
>exception
> Server.Transfer("ViewItem.aspx");
>
>Indeed, QueryString (or Form, or Params) are read-only
collection and
>therefore, it raises an exception. How can I pass an
addtionnal HTTP
>parameter ?
>
>Thanks in advance !
>
>Julien C.
>
>
>.
>

.



Nov 18 '05 #6

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

Similar topics

7
by: Zlatko Matiæ | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
0
by: Zlatko Matiæ | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
5
by: Fresh Air Rider | last post by:
Hello Could anyone please explain how I can pass more than one arguement/parameter value to a function using <asp:linkbutton> or is this a major shortfall of the language ? Consider the...
3
by: JezB | last post by:
I know I can use the querystring mechanism to pass simple parameters to a Page using Response.Redirect, but Im having problems getting this to work using Server.Transfer or Server.Execute - is this...
9
by: Paul | last post by:
What I am trying to do is as follows. I have a page with 3 links,that direct the user to 3 different pages when selected after login. So all link selections will first direct the user to a login...
5
by: Apollo0130 | last post by:
hi, i want to pass a parameter (a string) between two forms. i have a Webform A (default.aspx) with a button and a Webform B (detail.aspx). i want to click the button and open the webform B with...
3
by: hugo.flores | last post by:
Hello all. I want to know what would be the best way to pass information between pages in ASP.NET? Querystring, seession variables, server transfer? If possible if anyone can list...
17
by: Rabbit | last post by:
Hi, On my 1st page, i have a function which gets a new ID value and need to transfer to another immediately. which I want to get in 2nd page using Request.form("txtID"), but doesn't work, the...
3
by: David C | last post by:
With .NET 1.x, this is what I did. On the destination page public class ToWebForm : System.Web.UI.Page { public const string PARAMETER = "PARAM"; protected void Page_Load(object sender,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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...
0
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
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,...

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.