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

Problems with Server.Transfer

Hi guys,

I want to do a Server.Transfer to get to a second page, so that I may
retrieve variables I have set in the first page. I'm doing that with the
usual Server.Transfer("pagename", true). My problems are as follows:

1. On the initial load everything seems to be referencing from the first
page. For example, my style sheet I reference using "../../styles.css" but
it seems to need "../styles.css" as the first page is one step higher. When
I do anything on my page it fixes itself up. Is there a way to get around
this without hard coding the URL as I cannot be sure of the initial path?

2. When I finish with this page I want to go back to where I have come from
by pressing a button. How can I do this?

Thanks in advance,
Cathie
Nov 18 '05 #1
8 3763
Oops I also forgot one other problem:

3. For some reason when I do a Server.Transfer back to the page I came from
(first attempt at executing 2) I lose the jscript includes on the first
page. What is happening here?
"Cathie" <so*****@miscrosoft.com> wrote in message
news:uO**************@TK2MSFTNGP10.phx.gbl...
Hi guys,

I want to do a Server.Transfer to get to a second page, so that I may
retrieve variables I have set in the first page. I'm doing that with the
usual Server.Transfer("pagename", true). My problems are as follows:

1. On the initial load everything seems to be referencing from the first
page. For example, my style sheet I reference using "../../styles.css" but
it seems to need "../styles.css" as the first page is one step higher. When I do anything on my page it fixes itself up. Is there a way to get around
this without hard coding the URL as I cannot be sure of the initial path?

2. When I finish with this page I want to go back to where I have come from by pressing a button. How can I do this?

Thanks in advance,
Cathie

Nov 18 '05 #2
Cathie,

1. since you have a varying directory structure the path for css would
change correspondingly
if however you do not wish to be hassled by have to worry bout relative path
consider using an absolute path for css
one way would be to use ~ which converts to application path at run time.
if the css is located in styles directory under your root. consider using
"~/styles/styles.css"
from anywhere within the application this would correctly map to the precise
location.

2. I am not sure if you would be able to use Request.UrlReferrer variable as
you are using Server.Transfer
The way i normally do it is that on say edit for a item, i do a
response.redirect and since the request from the resource originates from
the client
on the Edit page's Page Load i set a variable in viewstate which refers to
the url of the referrer
if(!Page.IsPostback)
{
ViewState["URLReferrer"] = Request.UrlReferrer;
}

Now when the user clicks submit or cancel, i perform the task and i check
the value for ViewState["URLReferrer"] if it is not null i again to a
response.redirect to that url
if(ViewState["URLReferrer"] != null)
Response.Redirect(ViewState["URLReferrer"].toString());

hope this helps...

--
Regards,
HD
Once a Geek.... Always a Geek
"Cathie" <so*****@miscrosoft.com> wrote in message
news:uO**************@TK2MSFTNGP10.phx.gbl...
Hi guys,

I want to do a Server.Transfer to get to a second page, so that I may
retrieve variables I have set in the first page. I'm doing that with the
usual Server.Transfer("pagename", true). My problems are as follows:

1. On the initial load everything seems to be referencing from the first
page. For example, my style sheet I reference using "../../styles.css" but
it seems to need "../styles.css" as the first page is one step higher.
When
I do anything on my page it fixes itself up. Is there a way to get around
this without hard coding the URL as I cannot be sure of the initial path?

2. When I finish with this page I want to go back to where I have come
from
by pressing a button. How can I do this?

Thanks in advance,
Cathie

Nov 18 '05 #3
>Is there a way to get around
this without hard coding the URL as I cannot be sure of the initial path?


Simply use absolute paths.
____________________________________
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
DigitallySmooth Inc. | Quick Site Studio
Nov 18 '05 #4
Thanks for your advice. Unfortunately the ~ isn't working for me. It
doesn't seem to recognise it. Have you ever had this problem?

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:uQ**************@TK2MSFTNGP09.phx.gbl...
Cathie,

1. since you have a varying directory structure the path for css would
change correspondingly
if however you do not wish to be hassled by have to worry bout relative path consider using an absolute path for css
one way would be to use ~ which converts to application path at run time.
if the css is located in styles directory under your root. consider using
"~/styles/styles.css"
from anywhere within the application this would correctly map to the precise location.

2. I am not sure if you would be able to use Request.UrlReferrer variable as you are using Server.Transfer
The way i normally do it is that on say edit for a item, i do a
response.redirect and since the request from the resource originates from
the client
on the Edit page's Page Load i set a variable in viewstate which refers to
the url of the referrer
if(!Page.IsPostback)
{
ViewState["URLReferrer"] = Request.UrlReferrer;
}

Now when the user clicks submit or cancel, i perform the task and i check
the value for ViewState["URLReferrer"] if it is not null i again to a
response.redirect to that url
if(ViewState["URLReferrer"] != null)
Response.Redirect(ViewState["URLReferrer"].toString());

hope this helps...

--
Regards,
HD
Once a Geek.... Always a Geek
"Cathie" <so*****@miscrosoft.com> wrote in message
news:uO**************@TK2MSFTNGP10.phx.gbl...
Hi guys,

I want to do a Server.Transfer to get to a second page, so that I may
retrieve variables I have set in the first page. I'm doing that with the usual Server.Transfer("pagename", true). My problems are as follows:

1. On the initial load everything seems to be referencing from the first
page. For example, my style sheet I reference using "../../styles.css" but it seems to need "../styles.css" as the first page is one step higher.
When
I do anything on my page it fixes itself up. Is there a way to get around this without hard coding the URL as I cannot be sure of the initial path?
2. When I finish with this page I want to go back to where I have come
from
by pressing a button. How can I do this?

Thanks in advance,
Cathie


Nov 18 '05 #5
try converting the style tag to a server control ie a generic html control
put in id=style1 runat="server"
and see what happens...
leaving for work right now.. if you still have a problem i will try and sort
it in half an hours time

--
Regards,
HD
Once a Geek.... Always a Geek
"Cathie" <so*****@miscrosoft.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Thanks for your advice. Unfortunately the ~ isn't working for me. It
doesn't seem to recognise it. Have you ever had this problem?

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:uQ**************@TK2MSFTNGP09.phx.gbl...
Cathie,

1. since you have a varying directory structure the path for css would
change correspondingly
if however you do not wish to be hassled by have to worry bout relative

path
consider using an absolute path for css
one way would be to use ~ which converts to application path at run time.
if the css is located in styles directory under your root. consider using
"~/styles/styles.css"
from anywhere within the application this would correctly map to the

precise
location.

2. I am not sure if you would be able to use Request.UrlReferrer variable

as
you are using Server.Transfer
The way i normally do it is that on say edit for a item, i do a
response.redirect and since the request from the resource originates from
the client
on the Edit page's Page Load i set a variable in viewstate which refers
to
the url of the referrer
if(!Page.IsPostback)
{
ViewState["URLReferrer"] = Request.UrlReferrer;
}

Now when the user clicks submit or cancel, i perform the task and i check
the value for ViewState["URLReferrer"] if it is not null i again to a
response.redirect to that url
if(ViewState["URLReferrer"] != null)
Response.Redirect(ViewState["URLReferrer"].toString());

hope this helps...

--
Regards,
HD
Once a Geek.... Always a Geek
"Cathie" <so*****@miscrosoft.com> wrote in message
news:uO**************@TK2MSFTNGP10.phx.gbl...
> Hi guys,
>
> I want to do a Server.Transfer to get to a second page, so that I may
> retrieve variables I have set in the first page. I'm doing that with the > usual Server.Transfer("pagename", true). My problems are as follows:
>
> 1. On the initial load everything seems to be referencing from the
> first
> page. For example, my style sheet I reference using "../../styles.css" but > it seems to need "../styles.css" as the first page is one step higher.
> When
> I do anything on my page it fixes itself up. Is there a way to get around > this without hard coding the URL as I cannot be sure of the initial path? >
> 2. When I finish with this page I want to go back to where I have come
> from
> by pressing a button. How can I do this?
>
> Thanks in advance,
> Cathie
>
>



Nov 18 '05 #6
Cathie,

Did you get anywhere with your problem ?

--

Regards,
HD
"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:eV**************@TK2MSFTNGP09.phx.gbl...
try converting the style tag to a server control ie a generic html control
put in id=style1 runat="server"
and see what happens...
leaving for work right now.. if you still have a problem i will try and
sort it in half an hours time

--
Regards,
HD
Once a Geek.... Always a Geek
"Cathie" <so*****@miscrosoft.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Thanks for your advice. Unfortunately the ~ isn't working for me. It
doesn't seem to recognise it. Have you ever had this problem?

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:uQ**************@TK2MSFTNGP09.phx.gbl...
Cathie,

1. since you have a varying directory structure the path for css would
change correspondingly
if however you do not wish to be hassled by have to worry bout relative

path
consider using an absolute path for css
one way would be to use ~ which converts to application path at run
time.
if the css is located in styles directory under your root. consider
using
"~/styles/styles.css"
from anywhere within the application this would correctly map to the

precise
location.

2. I am not sure if you would be able to use Request.UrlReferrer
variable

as
you are using Server.Transfer
The way i normally do it is that on say edit for a item, i do a
response.redirect and since the request from the resource originates
from
the client
on the Edit page's Page Load i set a variable in viewstate which refers
to
the url of the referrer
if(!Page.IsPostback)
{
ViewState["URLReferrer"] = Request.UrlReferrer;
}

Now when the user clicks submit or cancel, i perform the task and i
check
the value for ViewState["URLReferrer"] if it is not null i again to a
response.redirect to that url
if(ViewState["URLReferrer"] != null)
Response.Redirect(ViewState["URLReferrer"].toString());

hope this helps...

--
Regards,
HD
Once a Geek.... Always a Geek
"Cathie" <so*****@miscrosoft.com> wrote in message
news:uO**************@TK2MSFTNGP10.phx.gbl...
> Hi guys,
>
> I want to do a Server.Transfer to get to a second page, so that I may
> retrieve variables I have set in the first page. I'm doing that with

the
> usual Server.Transfer("pagename", true). My problems are as follows:
>
> 1. On the initial load everything seems to be referencing from the
> first
> page. For example, my style sheet I reference using "../../styles.css"

but
> it seems to need "../styles.css" as the first page is one step higher.
> When
> I do anything on my page it fixes itself up. Is there a way to get

around
> this without hard coding the URL as I cannot be sure of the initial

path?
>
> 2. When I finish with this page I want to go back to where I have come
> from
> by pressing a button. How can I do this?
>
> Thanks in advance,
> Cathie
>
>



Nov 18 '05 #7
Thank you for your help. I couldn't get it to work but I decided to use
Response.Redirect instead and save the necessary variables to Session, this
gets rid of the relative referencing problem.

Sorry I didn't answer you last night but I went home before your last email.
Cathie.

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:OW**************@TK2MSFTNGP10.phx.gbl...
Cathie,

Did you get anywhere with your problem ?

--

Regards,
HD
"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:eV**************@TK2MSFTNGP09.phx.gbl...
try converting the style tag to a server control ie a generic html control put in id=style1 runat="server"
and see what happens...
leaving for work right now.. if you still have a problem i will try and
sort it in half an hours time

--
Regards,
HD
Once a Geek.... Always a Geek
"Cathie" <so*****@miscrosoft.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Thanks for your advice. Unfortunately the ~ isn't working for me. It
doesn't seem to recognise it. Have you ever had this problem?

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message news:uQ**************@TK2MSFTNGP09.phx.gbl...
Cathie,

1. since you have a varying directory structure the path for css would
change correspondingly
if however you do not wish to be hassled by have to worry bout relative path
consider using an absolute path for css
one way would be to use ~ which converts to application path at run
time.
if the css is located in styles directory under your root. consider
using
"~/styles/styles.css"
from anywhere within the application this would correctly map to the
precise
location.

2. I am not sure if you would be able to use Request.UrlReferrer
variable
as
you are using Server.Transfer
The way i normally do it is that on say edit for a item, i do a
response.redirect and since the request from the resource originates
from
the client
on the Edit page's Page Load i set a variable in viewstate which refers to
the url of the referrer
if(!Page.IsPostback)
{
ViewState["URLReferrer"] = Request.UrlReferrer;
}

Now when the user clicks submit or cancel, i perform the task and i
check
the value for ViewState["URLReferrer"] if it is not null i again to a
response.redirect to that url
if(ViewState["URLReferrer"] != null)
Response.Redirect(ViewState["URLReferrer"].toString());

hope this helps...

--
Regards,
HD
Once a Geek.... Always a Geek
"Cathie" <so*****@miscrosoft.com> wrote in message
news:uO**************@TK2MSFTNGP10.phx.gbl...
> Hi guys,
>
> I want to do a Server.Transfer to get to a second page, so that I may > retrieve variables I have set in the first page. I'm doing that with the
> usual Server.Transfer("pagename", true). My problems are as follows: >
> 1. On the initial load everything seems to be referencing from the
> first
> page. For example, my style sheet I reference using "../../styles.css" but
> it seems to need "../styles.css" as the first page is one step higher. > When
> I do anything on my page it fixes itself up. Is there a way to get
around
> this without hard coding the URL as I cannot be sure of the initial
path?
>
> 2. When I finish with this page I want to go back to where I have come > from
> by pressing a button. How can I do this?
>
> Thanks in advance,
> Cathie
>
>



Nov 18 '05 #8
Thank you for the update Cathie.
The response.redirect is a better choice specially when you consider the
client using browsers Back button. That sort of messes a few things up
(browser not knowing about internal transfer) if you use Server.Transfer
As for not replying the post earlier, its alright, time zones!!! getting
used to them over the years.
Glad that atleast in a way you have the code working.

--
Regards,
HD
Once a Geek.... Always a Geek
"Cathie" <so*****@miscrosoft.com> wrote in message
news:eg**************@TK2MSFTNGP09.phx.gbl...
Thank you for your help. I couldn't get it to work but I decided to use
Response.Redirect instead and save the necessary variables to Session,
this
gets rid of the relative referencing problem.

Sorry I didn't answer you last night but I went home before your last
email.
Cathie.

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:OW**************@TK2MSFTNGP10.phx.gbl...
Cathie,

Did you get anywhere with your problem ?

--

Regards,
HD
"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:eV**************@TK2MSFTNGP09.phx.gbl...
> try converting the style tag to a server control ie a generic html control > put in id=style1 runat="server"
> and see what happens...
> leaving for work right now.. if you still have a problem i will try and
> sort it in half an hours time
>
> --
> Regards,
> HD
> Once a Geek.... Always a Geek
> "Cathie" <so*****@miscrosoft.com> wrote in message
> news:%2******************@TK2MSFTNGP10.phx.gbl...
>> Thanks for your advice. Unfortunately the ~ isn't working for me. It
>> doesn't seem to recognise it. Have you ever had this problem?
>>
>> "Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message >> news:uQ**************@TK2MSFTNGP09.phx.gbl...
>>> Cathie,
>>>
>>> 1. since you have a varying directory structure the path for css
>>> would
>>> change correspondingly
>>> if however you do not wish to be hassled by have to worry bout relative >> path
>>> consider using an absolute path for css
>>> one way would be to use ~ which converts to application path at run
>>> time.
>>> if the css is located in styles directory under your root. consider
>>> using
>>> "~/styles/styles.css"
>>> from anywhere within the application this would correctly map to the
>> precise
>>> location.
>>>
>>> 2. I am not sure if you would be able to use Request.UrlReferrer
>>> variable
>> as
>>> you are using Server.Transfer
>>> The way i normally do it is that on say edit for a item, i do a
>>> response.redirect and since the request from the resource originates
>>> from
>>> the client
>>> on the Edit page's Page Load i set a variable in viewstate which refers >>> to
>>> the url of the referrer
>>> if(!Page.IsPostback)
>>> {
>>> ViewState["URLReferrer"] = Request.UrlReferrer;
>>> }
>>>
>>> Now when the user clicks submit or cancel, i perform the task and i
>>> check
>>> the value for ViewState["URLReferrer"] if it is not null i again to a
>>> response.redirect to that url
>>> if(ViewState["URLReferrer"] != null)
>>> Response.Redirect(ViewState["URLReferrer"].toString());
>>>
>>> hope this helps...
>>>
>>> --
>>> Regards,
>>> HD
>>> Once a Geek.... Always a Geek
>>> "Cathie" <so*****@miscrosoft.com> wrote in message
>>> news:uO**************@TK2MSFTNGP10.phx.gbl...
>>> > Hi guys,
>>> >
>>> > I want to do a Server.Transfer to get to a second page, so that I may >>> > retrieve variables I have set in the first page. I'm doing that with >> the
>>> > usual Server.Transfer("pagename", true). My problems are as follows: >>> >
>>> > 1. On the initial load everything seems to be referencing from the
>>> > first
>>> > page. For example, my style sheet I reference using "../../styles.css" >> but
>>> > it seems to need "../styles.css" as the first page is one step higher. >>> > When
>>> > I do anything on my page it fixes itself up. Is there a way to get
>> around
>>> > this without hard coding the URL as I cannot be sure of the initial
>> path?
>>> >
>>> > 2. When I finish with this page I want to go back to where I have come >>> > from
>>> > by pressing a button. How can I do this?
>>> >
>>> > Thanks in advance,
>>> > Cathie
>>> >
>>> >
>>>
>>>
>>
>>
>
>



Nov 18 '05 #9

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

Similar topics

6
by: clintonG | last post by:
After the last six days trying to download VS2005 Professional it seems there may be a problem with my instance of the File Transfer Manager (FTM) or somewhere in the network in between. I can't...
19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
1
by: Troy | last post by:
Hello, I'd like to pass data between two pages but unable to get code to work. Code is below and any help is appreciated: ...
2
by: dee | last post by:
Hi I'm posting back to a second page using Server.Transfer(). There are buttons on this second page that use Respose.Redirect() since some of the pages are html's and the Transfer function cant...
8
by: bryan | last post by:
I've got a custom HttpHandler to process all requests for a given extension. It gets invoked OK, but if I try to do a Server.Transfer I get an HttpException. A Response.Redirect works, but I really...
1
by: Webmills | last post by:
Has anyone come across the problem that I am experiencing? I have a master page using four or five Hyperlink controls, each with an ImageUrl. The ImageUrl is specified using a virtual directory...
1
by: Microsoft | last post by:
Error for Server.Transfer: Error: Error Executing Child Request MSDN: http://support.microsoft.com/default.aspx?scid=kb;en-us;320439 Says to use Response.Redirect but get this error here:...
2
by: morten44 | last post by:
Hello, I have just been to come2linux http://www.come2linux.org/psp/ and succesfully tried http://www.tntnet.org/ it really works, I have also experimented with apache and it is no...
1
by: leescriven | last post by:
Hi, Thi is my first post on this forum, and I'm hoping that there is a guru out there who can help me with an annoying problem I am having. I have written a Stored Procedure that relies heavily...
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: 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
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
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...

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.