Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > server.transfer acting inconsistently

Reply
Thread Tools

server.transfer acting inconsistently

 
 
=?Utf-8?B?cDN0M3I=?=
Guest
Posts: n/a
 
      02-08-2006
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.
 
Reply With Quote
 
 
 
 
Wei-Dong XU [MS]
Guest
Posts: n/a
 
      02-08-2006


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.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?cDN0M3I=?=
Guest
Posts: n/a
 
      02-09-2006
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.
>
>

 
Reply With Quote
 
Jeffrey Tan[MSFT]
Guest
Posts: n/a
 
      02-09-2006
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:
http://www.velocityreviews.com/forums/(E-Mail Removed)(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.

 
Reply With Quote
 
=?Utf-8?B?cDN0M3I=?=
Guest
Posts: n/a
 
      02-09-2006
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:
> (E-Mail Removed)(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.
>
>

 
Reply With Quote
 
Wei-Dong XU [MS]
Guest
Posts: n/a
 
      02-10-2006


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: (E-Mail Removed)(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.

 
Reply With Quote
 
=?Utf-8?B?cDN0M3I=?=
Guest
Posts: n/a
 
      02-10-2006
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: (E-Mail Removed)(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.
>
>

 
Reply With Quote
 
=?Utf-8?B?cDN0M3I=?=
Guest
Posts: n/a
 
      02-10-2006
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: (E-Mail Removed)(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.
> >
> >

 
Reply With Quote
 
Wei-Dong XU [MS]
Guest
Posts: n/a
 
      02-13-2006


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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ImageIO/BufferedImage behaving inconsistently from one day to thenext. Fred Greer Java 11 06-21-2012 12:58 PM
asp controls display inconsistently =?Utf-8?B?QmFyYg==?= ASP .Net 0 02-22-2006 09:03 PM
URGENT - ASP.NET Labels and LinkButtons behaving inconsistently ac Zahid ASP .Net Web Controls 8 12-19-2005 05:57 AM
Sony U30 inconsistently "losing" pictures on MemStick steve@portigal.com Digital Photography 11 10-25-2005 10:26 PM
Crystal Report Loads Inconsistently Corbin ASP .Net 0 02-03-2004 12:02 AM



Advertisments