Re: Parser Error Message: Server tags cannot contain <% ... %> constructs.
From: Philip Q [MVP] (wisemonk_at_NOSPAMmvps.org)
Date: 01/12/05
- Next message: Philip Q [MVP]: "Re: Web Matrix or Visual Studio .NET?"
- Previous message: Frustrated Newbe: "ASP.NET app can't read a registry key"
- In reply to: Neil Zanella: "Parser Error Message: Server tags cannot contain <% ... %> constructs."
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 12 Jan 2005 19:16:46 +1300
The reason is because you are declaring your form to be an ASP.NET form, and
so ASP.NET manages the postback and form submission process (which is the
prefered way).
However, to do it the way that you are proposing, remove the runat="server"
attribute from the <form> tag.
-- Philip Q Microsoft MVP [ASP.NET] "Neil Zanella" <nzanella@cs.mun.ca> wrote in message news:b68d2f19.0501111738.4b5abe07@posting.google.com... > Hello, > > I would like to do the following: > > <form method="post" > action="<%= Request.ServerVariables["URL"] %>" > runat="server"> > > The reason I would like to do this is twofold: > > 1. I want my page to be such that when I post I get > rid of the query string appended at the end of the URL. > > 2. I want my code to be such that when I rename the file that > containins it I don't have to change the name of the .aspx > file in all enclosed action fields. > > In PHP, this would have been possible using the PHP_SELF variable. > However, when using ASP.NET, IIS issues the following error message, > which is unfortunate (should I say stupid, given that PHP can do it): > > Parser Error Message: Server tags cannot contain <% ... %> constructs. > > I wonder why ASP.NET would impose this restriction, and wonder if there > is a workaround for this problem in ASP.NET. > > Suggestions welcome, > > Best Regards, > > Neil
- Next message: Philip Q [MVP]: "Re: Web Matrix or Visual Studio .NET?"
- Previous message: Frustrated Newbe: "ASP.NET app can't read a registry key"
- In reply to: Neil Zanella: "Parser Error Message: Server tags cannot contain <% ... %> constructs."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|