G
Gary K
I realize that there is no good reason for an image button to not have an
ImageUrl but I have just hit upon a strange problem when converting an
ASP.NET 1.1 web application to 2.0. An asp:ImageButton control without an
ImageUrl contained within a WebForm causes a redirect to the default
document in IIS. This behaviour did not occur in .NET 1.1.
This can easily be duplicated by the following steps :-
1. Create a new ASP.NET Web Application project in VS2005.
2. Add a new Web Form (WebForm1.aspx)
3. In the existing Default.aspx add a standard asp:Button to the form and
add a standard on click event handler containing a simple
Response.Redirect("WebForm1.aspx");
4. Add an asp:ImageButton to WebForm1.aspx, e.g <asp:ImageButton
ID="ImageButton1" runat="server" />
5. Set two breakpoints, one on each Page_Load method of both Web Forms.
Debug the application, you will notice it breakpoints on the Default.aspx
page load and on the postback when you press the button. This is fine. It
will then breakpoint on the page load of WebForm1.aspx and *THEN* redirect
back to Default.aspx and break on the page load event again. The final
breakpoint does not occur if the ImageUrl is completed or if no default
document has been setup in IIS.
Thanks
Gary
ImageUrl but I have just hit upon a strange problem when converting an
ASP.NET 1.1 web application to 2.0. An asp:ImageButton control without an
ImageUrl contained within a WebForm causes a redirect to the default
document in IIS. This behaviour did not occur in .NET 1.1.
This can easily be duplicated by the following steps :-
1. Create a new ASP.NET Web Application project in VS2005.
2. Add a new Web Form (WebForm1.aspx)
3. In the existing Default.aspx add a standard asp:Button to the form and
add a standard on click event handler containing a simple
Response.Redirect("WebForm1.aspx");
4. Add an asp:ImageButton to WebForm1.aspx, e.g <asp:ImageButton
ID="ImageButton1" runat="server" />
5. Set two breakpoints, one on each Page_Load method of both Web Forms.
Debug the application, you will notice it breakpoints on the Default.aspx
page load and on the postback when you press the button. This is fine. It
will then breakpoint on the page load of WebForm1.aspx and *THEN* redirect
back to Default.aspx and break on the page load event again. The final
breakpoint does not occur if the ImageUrl is completed or if no default
document has been setup in IIS.
Thanks
Gary