ASP.NET 1.1 - "<%=" and "%>" tags being rendered in address bar
I inherited an ASP.NET 1.1 application that was written about 8 years ago, the app is obviously someone's first imm开发者_JAVA百科ersion in .NET as the code is a mixture of code-behind as well as server-side scattered throughout the markup.
The problem I'm having is that the form label has an action that looks like this:
<form name="myForm" id="myForm" method="post" action="?id=<%= fooId %>" runat="server">
When the save button is hovered over I see in the status bar:
?id=<%= fooId %>
As opposed to:
?id=123
If the user clicks the save button, the address bar shows:
http://servername/virtdir/pagename.aspx?id=<%= fooid %>
Which obviously causes the application to throw an exception. I've tried using:
action="?id=<% Response.Write(fooId) %>"
But still get the same problem. The problem is localized to this page, what else can I try?
Thanks,
You can't put <%= into a runat=server tag - your telling it to break into server side code when it already is. Try setting the action programatically in the codebehind.
精彩评论