Re: Parser Error Message: Server tags cannot contain <% ... %> constructs.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Philip Q [MVP] (wisemonk_at_NOSPAMmvps.org)
Date: 01/12/05


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 


Relevant Pages

  • Parser Error Message: Server tags cannot contain <% ... %> constructs.
    ... The reason I would like to do this is twofold: ... In PHP, this would have been possible using the PHP_SELF variable. ... However, when using ASP.NET, IIS issues the following error message, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: include file
    ... For some reason, I got error message "somefunctionnot found" ... Cannot redeclare somefunction() (previously declared in ...
    (comp.lang.php)
  • include file
    ... For some reason, I got error message "somefunctionnot found" ... Cannot redeclare somefunction() (previously declared in ...
    (comp.lang.php)
  • Re: Making groups
    ... It's actually the native array type in PHP. ... One more reason to avoid PHP. ... I've been doing database stuff since oracle cost $100K a seat. ... They're actually exceedingly useful once you get used to them. ...
    (comp.lang.tcl)
  • Re: Beginner Projects
    ... it would be too large starting out as a beginner PHP programmer. ... regulations requiring this and students challenging their grades etc ... will also need to be familiar with SQL (a database language). ... Is there a reason why you ...
    (comp.lang.php)