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

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

From: Neil Zanella (nzanella_at_cs.mun.ca)
Date: 01/12/05


Date: 11 Jan 2005 17:38:35 -0800

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

  • Re: Parser Error Message: Server tags cannot contain <% ... %> constructs.
    ... "Neil Zanella" wrote in message ... > 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)