Home All Groups Group Topic Archive Search About

Server.Transfer Does Not Invoke IsPostBack in .NET Framework 1.1

Author
23 Dec 2005 7:29 PM
Alex
Hello,

Quick question and I would really appreciate if anybody could helps me.
Here are the steps to reproduce the problem. Create simple ASP.Net
application. In code behind added protected class variable:

protected string _result = "No result";

Page Load event has:

if (IsPostBack)
_result = "Posted back";
else
_result = "Loaded";

Form has the following code:

<html>
  <head>
    <title>WebForm1</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 MS_POSITIONING="GridLayout">
    <Form method="POST" name="ScheduleApptForm" id="ScheduleApptForm"
runat="server">
    This is Test Control display content!!!! Result : <%=_result%>
    <br>
    <asp:Button class="ScheduleApptFormSubmit" id="_btnSend"
        runat="server" Height="21" text="Schedule Your Appointment"
TabIndex="18"></asp:Button></TD>
    </Form>
  </body>
</html>

Everything works fine until I have added in Global, Application_BeginRequest
following code:

Server.Transfer("WebForm1.aspx"); // or any other form name. Just trying to
transfer form to itself.

And that’s it. IsPostBack returns incorrect value. This issue definitely the
one mentioned in
http://support.microsoft.com/default.aspx?scid=kb;EN-US;821758 and should be
fixed two years ago. I have reinstalled Microsoft .NET Framework 1.1 Service
Pack 1. It doesn’t help. Any idea or suggestion of what I did wrong? Does it
mean that Service Pack installed incorectly?

Regards,
Alex.

Author
24 Dec 2005 7:15 PM
Nathan Sokalski
I think you have misunderstood what Server.Transfer does. Based on what you
have said, I would recommend using Response.Redirect instead. For more
details, try visiting the following site:

http://www.developer.com/net/asp/article.php/3299641

Good Luck!
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quoteHide quote
"Alex" <A***@discussions.microsoft.com> wrote in message
news:17B4B00D-D75E-414A-BCC6-B1248D739073@microsoft.com...
> Hello,
>
> Quick question and I would really appreciate if anybody could helps me.
> Here are the steps to reproduce the problem. Create simple ASP.Net
> application. In code behind added protected class variable:
>
> protected string _result = "No result";
>
> Page Load event has:
>
> if (IsPostBack)
> _result = "Posted back";
> else
> _result = "Loaded";
>
> Form has the following code:
>
> <html>
>  <head>
>    <title>WebForm1</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 MS_POSITIONING="GridLayout">
> <Form method="POST" name="ScheduleApptForm" id="ScheduleApptForm"
> runat="server">
> This is Test Control display content!!!! Result : <%=_result%>
> <br>
> <asp:Button class="ScheduleApptFormSubmit" id="_btnSend"
> runat="server" Height="21" text="Schedule Your Appointment"
> TabIndex="18"></asp:Button></TD>
> </Form>
>  </body>
> </html>
>
> Everything works fine until I have added in Global,
> Application_BeginRequest
> following code:
>
> Server.Transfer("WebForm1.aspx"); // or any other form name. Just trying
> to
> transfer form to itself.
>
> And that's it. IsPostBack returns incorrect value. This issue definitely
> the
> one mentioned in
> http://support.microsoft.com/default.aspx?scid=kb;EN-US;821758 and should
> be
> fixed two years ago. I have reinstalled Microsoft .NET Framework 1.1
> Service
> Pack 1. It doesn't help. Any idea or suggestion of what I did wrong? Does
> it
> mean that Service Pack installed incorectly?
>
> Regards,
> Alex.
Are all your drivers up to date? click for free checkup

Author
24 Dec 2005 8:54 PM
Alex
Hello Nathan,

Thanks for the replay :-). I know what Server.Transfer does and what
Response.Redirect does. I don’t need to redirect my request to new URL (by
301, 302 or any other reason). I just want the different pages handle
different requests based on parameters on SERVER SIDE. Client (browser)
should not be aware of this internal process. (I.E. supporting such
functionality as ‘skins’ as so on).  But any way, my question is not why I
have to use Server.Transfer. The question is why IsPostBack is not
initialized correctly after Server.Transfer call, but should be accordingly
to  'http://support.microsoft.com/default.aspx?scid=kb;EN-US;821758'.
By the way I have reinstalled Microsoft .NET Framework 1.1 Service Pack 1
twise. (that hot fix is included in Servise Pack)

Thanks for the attempt to help.

Regards,
Alex.


Show quoteHide quote
"Nathan Sokalski" wrote:

> I think you have misunderstood what Server.Transfer does. Based on what you
> have said, I would recommend using Response.Redirect instead. For more
> details, try visiting the following site:
>
> http://www.developer.com/net/asp/article.php/3299641
>
> Good Luck!
> --
> Nathan Sokalski
> njsokal***@hotmail.com
> http://www.nathansokalski.com/
>
> "Alex" <A***@discussions.microsoft.com> wrote in message
> news:17B4B00D-D75E-414A-BCC6-B1248D739073@microsoft.com...
> > Hello,
> >
> > Quick question and I would really appreciate if anybody could helps me.
> > Here are the steps to reproduce the problem. Create simple ASP.Net
> > application. In code behind added protected class variable:
> >
> > protected string _result = "No result";
> >
> > Page Load event has:
> >
> > if (IsPostBack)
> > _result = "Posted back";
> > else
> > _result = "Loaded";
> >
> > Form has the following code:
> >
> > <html>
> >  <head>
> >    <title>WebForm1</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 MS_POSITIONING="GridLayout">
> > <Form method="POST" name="ScheduleApptForm" id="ScheduleApptForm"
> > runat="server">
> > This is Test Control display content!!!! Result : <%=_result%>
> > <br>
> > <asp:Button class="ScheduleApptFormSubmit" id="_btnSend"
> > runat="server" Height="21" text="Schedule Your Appointment"
> > TabIndex="18"></asp:Button></TD>
> > </Form>
> >  </body>
> > </html>
> >
> > Everything works fine until I have added in Global,
> > Application_BeginRequest
> > following code:
> >
> > Server.Transfer("WebForm1.aspx"); // or any other form name. Just trying
> > to
> > transfer form to itself.
> >
> > And that's it. IsPostBack returns incorrect value. This issue definitely
> > the
> > one mentioned in
> > http://support.microsoft.com/default.aspx?scid=kb;EN-US;821758 and should
> > be
> > fixed two years ago. I have reinstalled Microsoft .NET Framework 1.1
> > Service
> > Pack 1. It doesn't help. Any idea or suggestion of what I did wrong? Does
> > it
> > mean that Service Pack installed incorectly?
> >
> > Regards,
> > Alex.
>
>
>

Bookmark and Share