Hi Nedu,
Thank you for using MSDN Newsgroup! My name is Steven, and I'll be
assisting you on this issue.
From your description, you used the "Server.Transfer" method in your
ASP.NET web application. And the web page worked well on the dev machine,
however didn't work correctly on the production server.
If there is anything I misunderstood, please feel free to let me know.
Based on my research, there does occurs some problem on the Server.Transfer
method. This method is a new method in the IIS5. Also, here are some KB
articles I've found which are focus on this problem(both in .NET 1.1 or 1.0
), there're some different causes may lead to this method's not working :
#FIX: Calling Server.Transfer Skips Execution of Custom HTTP Filters
http://support.microsoft.com/?id=814206
#FIX: Server.Transfer Does Not Invoke IsPostBack in .NET Framework 1.1
http://support.microsoft.com/default.aspx?id=821758
#Postback Event Not Called When RewritePath Uses Server.Transfer or
Server.Execute
http://support.microsoft.com/?id=817036
You may check out the above items and compare it with both of your
enviroments to see whether there're any clues. Also, since I'm not sure
about your actual enviroment, I've tested some code on my side, but haven't
repro the same problem. So I recommend that you try a simpler page which
use the "Server.Transfer" method and use the Response.Write to output some
debug infos so as to see whether there're any thing incorrect or just to
find the runtime difference between the dev server and the prod server. And
here is a page I used to test it, you may have a reference:
---------------------------------ASPX
page--------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>ServerTransfer</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table width="500" align="center">
<tr>
<td>
<asp:TextBox id="txtInput" runat="server"></asp:TextBox></td>
<td>
<asp:Button id="btnSubmit" runat="server"
Text="Submit"></asp:Button></td>
</tr>
<tr>
<td><FONT face="ËÎÌå"></FONT></td>
<td></td>
</tr>
</table>
</form>
</body>
</HTML>
-------------------------------------code behind page
class------------------------------------
public class ServerTransfer : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox txtInput;
protected System.Web.UI.WebControls.Button btnSubmit;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
Response.Write("<br>Page.IsPostBack:" + IsPostBack.ToString());
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnSubmit_Click(object sender, System.EventArgs e)
{
if(txtInput.Text.Equals("ABCD"))
{
Response.Write("<script> alert('Can not insert ABCD!');</script>");
}
else
{
Response.Write("<script> alert('Insert successfully!!');</script>");
Server.Transfer("ServerTransfer.aspx");
}
}
}
Please try out my suggestion. If you need any help or have any new
findings, please feel free to let me know.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)