468,771 Members | 1,930 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,771 developers. It's quick & easy.

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 7612
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Zlatko Matiæ | last post: by
3 posts views Thread by JezB | last post: by
9 posts views Thread by Paul | last post: by
5 posts views Thread by Apollo0130 | last post: by
3 posts views Thread by hugo.flores | last post: by
3 posts views Thread by David C | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.