473,748 Members | 9,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

server.transfer acting inconsistently

I am using .NET2 and have a number of aspx pages. On each page is a
LinkButton that performs a server.transfer () to another page.

If we use page names A,B,C,D,E as an example. I start on page A and do a
server.transfer to page B. The address bar still shows page A (which is what
I want). Page B then does a server.transfer to page C. Now the address bar
shows the URL for page B (not C and not A which is what I want). Every new
server.transfer changes the address bar URL to show the name of the previous
page.

How do I transfer control to a new page without the address bar URL changing
at all? Is there some setting on the pages that causes the address bar URL to
change like this.

Just in case it makes a difference, every page uses the same master page.

Thanks, in advance.
Feb 8 '06 #1
8 1835


Hi,

Thanks for posting at the newsgroup!

I have create five ASPx page and test the Server.Transfer method. However,
I doesnot reproduct the issue you describled that the url will be changed
one by one.

Please see my sample:
The first aspx page (Default.aspx):
//---------------------------
<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs"
Inherits="_Defa ult" %>
<script language="C#" runat="server">
protected void Page_Load(objec t sender, EventArgs e)
{
Server.Transfer ("default2.aspx ");
}
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
</body>
</html>
//---------------------------
From the 2nd to the 4th, the code is the mostly same except the name is
different from Default2.aspx - Default4.aspx and the Transfer parameter is
different at each page to call the next one as below for each.
Server.Transfer ("default3.aspx ");
Server.Transfer ("default4.aspx ");
Server.Transfer ("default5.aspx ");

The 5th page:
//---------------------------
<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt5.aspx.cs"
Inherits="Defau lt5" %>

<script language="C#" runat="server">
protected void Page_Load(objec t sender, EventArgs e)
{
for (int i = 0; i < 10000; i++)
{
Response.Write( "hello world!");
}
}
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>

</body>
</html>
//---------------------------
At the 5th page, generate 10 thousand sentence "hello world!".

Based on my test, the url is always the one for default.aspx. No any other
url is showed in IE address box.

So could you be so kind to give me one reproduce steps and sample pages on
this issue? I will perform the further research for you then.

Please feel free to let me know if you have any further question on this
issue.

Have a nice day!

Best Regards,
Wei-Dong XU
Microsoft Support
---------------------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
---------------------------------------------------------------------------
It is my pleasure to be of any assistance.

Feb 8 '06 #2
I cannot send you the real pages, but tomrrow I will put together 3 or 4 test
pages that (hopefully) have the same problem. Can I send you email (zip file)
of the source?
"Wei-Dong XU [MS]" wrote:


Hi,

Thanks for posting at the newsgroup!

I have create five ASPx page and test the Server.Transfer method. However,
I doesnot reproduct the issue you describled that the url will be changed
one by one.

Please see my sample:
The first aspx page (Default.aspx):
//---------------------------
<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs"
Inherits="_Defa ult" %>
<script language="C#" runat="server">
protected void Page_Load(objec t sender, EventArgs e)
{
Server.Transfer ("default2.aspx ");
}
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
</body>
</html>
//---------------------------
From the 2nd to the 4th, the code is the mostly same except the name is
different from Default2.aspx - Default4.aspx and the Transfer parameter is
different at each page to call the next one as below for each.
Server.Transfer ("default3.aspx ");
Server.Transfer ("default4.aspx ");
Server.Transfer ("default5.aspx ");

The 5th page:
//---------------------------
<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt5.aspx.cs"
Inherits="Defau lt5" %>

<script language="C#" runat="server">
protected void Page_Load(objec t sender, EventArgs e)
{
for (int i = 0; i < 10000; i++)
{
Response.Write( "hello world!");
}
}
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>

</body>
</html>
//---------------------------
At the 5th page, generate 10 thousand sentence "hello world!".

Based on my test, the url is always the one for default.aspx. No any other
url is showed in IE address box.

So could you be so kind to give me one reproduce steps and sample pages on
this issue? I will perform the further research for you then.

Please feel free to let me know if you have any further question on this
issue.

Have a nice day!

Best Regards,
Wei-Dong XU
Microsoft Support
---------------------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
---------------------------------------------------------------------------
It is my pleasure to be of any assistance.

Feb 9 '06 #3
Hi,

Thanks for your feedback.

I am the colleague of "Wei-Dong XU [MS]". You can send the sample reproduce
project to him with the address below:
v-****@online.mic rosoft.com(remove "online.")

We look forward to hearing from you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Feb 9 '06 #4
Email has been sent. I have 3 pages using a single master page.

Start on page1 and server.transfer to page 2, the address bar still shows
page1
Click to transfer to page 3 and the address bar will change to page2 even
though page 3 is being displayed.
""Jeffrey Tan[MSFT]"" wrote:
Hi,

Thanks for your feedback.

I am the colleague of "Wei-Dong XU [MS]". You can send the sample reproduce
project to him with the address below:
v-****@online.mic rosoft.com(remove "online.")

We look forward to hearing from you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Feb 9 '06 #5


Thanks for the update! Howver, after waiting for 6 hours today, I didnot
see your email in my outlook inbox. So could you be so kind to resend it
and compress the pages in one zip package? Perhaps the restricted email
filtering system and antivirus checking has stopped your email from my
inbox.

My email address is: v-****@online.mic rosoft.com(please remove "online")

Thanks! Have a nice weekend!

Best Regards,
Wei-Dong Xu
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== ========
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
<https://partner.microso ft.com/US/technicalsuppor t/supportoverview/40010469>

Others: <https://partner.microso ft.com/US/technicalsuppor t/supportoverview/>
If you are outside the United States, please visit our International
Support page:
<http://support.microso ft.com/default.aspx?sc id=%2finternati onal.aspx>.
=============== =============== =============== ========
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 10 '06 #6
butI did use just a single file attachment and the address was the same. It
did not bounce but I will resend it again now.

Here's a sample of the code. If you make 3 copies of the content page you
should be able to reproduce the problem.

Each page looks like this:
<%@ Page Language="VB" MasterPageFile= "~/Test/TestMasterPage. master"
AutoEventWireup ="false" CodeFile="pag1. aspx.vb" Inherits="Test_ pag1"
title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server">
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border =
"0">
<tr>
<td align="center">
<p>You are on page 1</p>
<p>
<asp:LinkButt on ID="LinkButton1 " runat="server"> Goto Page
2</asp:LinkButton> </p>
</td>
</tr>
</table>
</asp:Content>

The .vb behind each page looks like this:

Partial Class Test_pag1
Inherits System.Web.UI.P age

Protected Sub LinkButton1_Cli ck(ByVal sender As Object, ByVal e As
System.EventArg s) Handles LinkButton1.Cli ck
Server.Transfer ("pag2.aspx" )
End Sub
End Class

The master page is:
<%@ Master Language="VB" CodeFile="TestM asterPage.maste r.vb"
Inherits="Test_ TestMasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:contentpla ceholder id="ContentPlac eHolder1" runat="server">
</asp:contentplac eholder>
</div>
</form>
</body>
</html>

-------------------------------------------------------------------------

"Wei-Dong XU [MS]" wrote:


Thanks for the update! Howver, after waiting for 6 hours today, I didnot
see your email in my outlook inbox. So could you be so kind to resend it
and compress the pages in one zip package? Perhaps the restricted email
filtering system and antivirus checking has stopped your email from my
inbox.

My email address is: v-****@online.mic rosoft.com(please remove "online")

Thanks! Have a nice weekend!

Best Regards,
Wei-Dong Xu
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== ========
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
<https://partner.microso ft.com/US/technicalsuppor t/supportoverview/40010469>

Others: <https://partner.microso ft.com/US/technicalsuppor t/supportoverview/>
If you are outside the United States, please visit our International
Support page:
<http://support.microso ft.com/default.aspx?sc id=%2finternati onal.aspx>.
=============== =============== =============== ========
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 10 '06 #7
Email problem was at my end. The server recognized that the zip file
contained code and would not let it out.

I sent you another copy using a different email.

"p3t3r" wrote:
butI did use just a single file attachment and the address was the same. It
did not bounce but I will resend it again now.

Here's a sample of the code. If you make 3 copies of the content page you
should be able to reproduce the problem.

Each page looks like this:
<%@ Page Language="VB" MasterPageFile= "~/Test/TestMasterPage. master"
AutoEventWireup ="false" CodeFile="pag1. aspx.vb" Inherits="Test_ pag1"
title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server">
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border =
"0">
<tr>
<td align="center">
<p>You are on page 1</p>
<p>
<asp:LinkButt on ID="LinkButton1 " runat="server"> Goto Page
2</asp:LinkButton> </p>
</td>
</tr>
</table>
</asp:Content>

The .vb behind each page looks like this:

Partial Class Test_pag1
Inherits System.Web.UI.P age

Protected Sub LinkButton1_Cli ck(ByVal sender As Object, ByVal e As
System.EventArg s) Handles LinkButton1.Cli ck
Server.Transfer ("pag2.aspx" )
End Sub
End Class

The master page is:
<%@ Master Language="VB" CodeFile="TestM asterPage.maste r.vb"
Inherits="Test_ TestMasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:contentpla ceholder id="ContentPlac eHolder1" runat="server">
</asp:contentplac eholder>
</div>
</form>
</body>
</html>

-------------------------------------------------------------------------

"Wei-Dong XU [MS]" wrote:


Thanks for the update! Howver, after waiting for 6 hours today, I didnot
see your email in my outlook inbox. So could you be so kind to resend it
and compress the pages in one zip package? Perhaps the restricted email
filtering system and antivirus checking has stopped your email from my
inbox.

My email address is: v-****@online.mic rosoft.com(please remove "online")

Thanks! Have a nice weekend!

Best Regards,
Wei-Dong Xu
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== ========
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
<https://partner.microso ft.com/US/technicalsuppor t/supportoverview/40010469>

Others: <https://partner.microso ft.com/US/technicalsuppor t/supportoverview/>
If you are outside the United States, please visit our International
Support page:
<http://support.microso ft.com/default.aspx?sc id=%2finternati onal.aspx>.
=============== =============== =============== ========
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 10 '06 #8


Hi,

Thanks for the great file!

Based on my test, this issue is the expected behaivor in ASP.net 2.0. This
reason is:
Because the transfer between source and target pages happens on the server,
the browser has no information about the changed page, and it retains
information about the original (source) URL.

So when we click the link "Goto Page 2" at page 1, the redirect is working
at the server side and pass the page2 to the client box. However, since the
redirect is happend at the server side, the client url will not be changed
which still show the url for page1. Then when we click the link "Goto Page
3", the tranfer will happen in server-side as well and the IE will show the
content of page 3. However, since this transfer is started from the
pag2.aspx. Then IE will update the url to pag2.aspx. Then for the preceding
transfer, this procedure happen the same.

From the MSDN article on introducing the Transfer method, it suggests that:
This option is best used in situations where the URL is hidden from the
user.
*Redirecting Users to Another Page
http://msdn2.microsoft.com/en-us/library/x3x8t37x.aspx

"How do I transfer control to a new page without the address bar URL
changing at all"
For this requirement, I'd suggest:
1. Please don't tranfer more than once at your page. As the description
above, the first transfer in the page will not change the url.
2. Modify the logic to avoid the usage of Transfer. We could encapsulate
the logic into one library. For the Transfer operation, please call the
library to perform the processing.
3. Consider to embed one iFrame at your page so that we only need to change
the IFrame page source and there is no modificaiton to the current URL in
the browser address bar.

Please feel free to let me know if you have any further question on this
issue.

Have a nice day!

Best Regards,
Wei-Dong XU
Microsoft Support
---------------------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
---------------------------------------------------------------------------
It is my pleasure to be of any assistance.

Feb 13 '06 #9

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

Similar topics

3
2219
by: Lad | last post by:
I have a program that can send posts to a news server.The problem is that I must find a free usenet(news) server that allows posting, which is not easy. For this reason I would like to make a modification in my program so that the program can act in a similar way how real news server, that is to spread the new posts to another news server. But I do not have much knowledge about the way how news server chooses another news server to send...
6
2237
by: StephenMcC | last post by:
Hi All, Got a quick query in relation to the Server.Transfer method available in IIS 5+/ASP. I've got an issue where I want to take a portion of an online app and extract this out into a web site on its own, so I will end up having two web sites. This planned to aid problems we've been having with performance, as if the portion (which is an app in its own right) has problems we then have to restart the whole site and so bring everything...
4
2115
by: Harsh Thakur | last post by:
Hi, I'd like to know the performance related differences between Response.Redirect and Server.Transfer. I'd like to redirect the user to a different page. I can either do a Response.Redirect("URL") or a Server.Transfer("URL"). So I'd like to find out which is more efficient/better. Can anyone please tell me or give any pointers to links on the web? Thanks & Regards
5
7828
by: Julien C. | last post by:
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,
9
4612
by: Mark | last post by:
Hello I'm trying to use a Server.Transfer in a try-catch (I cannot put it outside the Try-Catch as it is nested deep within a component that is called in a try-catch loop) The problem is that the Server.Transfer always throws the ThreadAbortException. MSDN acknowledges that this is a unque exception that will be automatically rethrown - i.e. it can't be swallowed. Does anyone know if there is extar code I can write (maybe something in the...
5
2583
by: Guadala Harry | last post by:
I've been reading up on Server.Transfer as well as doing some testing, and it appears to always raise the ThreadAbortException error. On one hand I've read a bunch of promotional-type material touting the benefits of Server.Transfer and none of them mention ThreadAbortException - but the MSDN documentation says Server.Transfer will always cause that exception - by design - and that the work-around is to not use Server.Transfer (and to use...
11
6044
by: Alexander Bosch | last post by:
Hi, I'm having a problem similar to the one that's stated in this KB http://support.microsoft.com/default.aspx?scid=kb;en-us;839521 When I'm posting a page to itself with the bool value as true it falls into an infinite loop and later a StackOverflow Exception. I need to do this and not a Response.Redirect or a transfer with the bool in false. My problem is that this KB is saying that this problem should be solved with ServicePack 1 of...
8
3900
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 need to avoid the extra round-trip to the client. I've tried Passing the page name, the full URL, and the instance of the handler class to the Transfer method, but everything gets me the same error 500. Any help would be appreciated.
6
2189
by: n# | last post by:
A Basic Question in ASP.NEt 1.1 In Page_Load Event I am doing a Server.Transfer. But it throws an error on the browser windows showing "Server Application Not Found" Pls help me
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9541
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9247
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.