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

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 1799


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="Default.aspx.cs"
Inherits="_Default" %>
<script language="C#" runat="server">
protected void Page_Load(object 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.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled 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="Default5.aspx.cs"
Inherits="Default5" %>

<script language="C#" runat="server">
protected void Page_Load(object 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.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled 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="Default.aspx.cs"
Inherits="_Default" %>
<script language="C#" runat="server">
protected void Page_Load(object 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.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled 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="Default5.aspx.cs"
Inherits="Default5" %>

<script language="C#" runat="server">
protected void Page_Load(object 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.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled 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.microsoft.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.microsoft.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.microsoft.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.microsoft.com/US/technicalsupport/supportoverview/40010469>

Others: <https://partner.microsoft.com/US/technicalsupport/supportoverview/>
If you are outside the United States, please visit our International
Support page:
<http://support.microsoft.com/default.aspx?scid=%2finternational.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" ContentPlaceHolderID="ContentPlaceHolder1"
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:LinkButton 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.Page

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles LinkButton1.Click
Server.Transfer("pag2.aspx")
End Sub
End Class

The master page is:
<%@ Master Language="VB" CodeFile="TestMasterPage.master.vb"
Inherits="Test_TestMasterPage" %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</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.microsoft.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.microsoft.com/US/technicalsupport/supportoverview/40010469>

Others: <https://partner.microsoft.com/US/technicalsupport/supportoverview/>
If you are outside the United States, please visit our International
Support page:
<http://support.microsoft.com/default.aspx?scid=%2finternational.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" ContentPlaceHolderID="ContentPlaceHolder1"
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:LinkButton 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.Page

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles LinkButton1.Click
Server.Transfer("pag2.aspx")
End Sub
End Class

The master page is:
<%@ Master Language="VB" CodeFile="TestMasterPage.master.vb"
Inherits="Test_TestMasterPage" %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</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.microsoft.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.microsoft.com/US/technicalsupport/supportoverview/40010469>

Others: <https://partner.microsoft.com/US/technicalsupport/supportoverview/>
If you are outside the United States, please visit our International
Support page:
<http://support.microsoft.com/default.aspx?scid=%2finternational.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
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...
6
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...
4
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...
5
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...
9
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...
5
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...
11
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...
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...
6
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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.