473,503 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
Nov 19 '05 #1
1 3314
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" <nz******@cs.mun.ca> wrote in message
news:b6**************************@posting.google.c om...
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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4245
by: Leila | last post by:
Hi folks, I have a fairly complex xml document which looks like this: <my:InsideView xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-08-02T14:22:59" xml:lang="en-us">...
16
6290
by: Mike | last post by:
Does anyone know of a minimal/mini/tiny/small xml parser in c? I'm looking for something small that accepts a stream or string, builds a c structure, and then returns an opaque pointer to that...
5
3749
by: Donald Firesmith | last post by:
Are html tags allowed within meta tags? Specifically, if I have html tags within a <definition> tag within XML, can I use the definition as the content within the <meta content="description> tag? ...
5
7562
by: Monty | last post by:
..rowbackgrnd { background-color: #E4E4F2; border-bottom: 1px solid Black; border-left: 1px solid #E4E4F2; border-right: 1px solid #E4E4F2; border-top: 1px solid Black } It works for <td>...
8
1520
by: Peter van Schie | last post by:
Hi all, Give an xml document that looks something like this: <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl"...
11
3098
by: Wolfgang Kaml | last post by:
I am not sure if this is more of an expert question, but I am sure that they are out there. I'd like to setup a general application or bin directory on my Win2003.Net Server that will hold some...
4
2299
by: Neo Geshel | last post by:
Just moved to C# from VB.NET, frustrated to hell and back by inability to get much-copied (from about 20+ different resources) literal example to work. Master Page content: <meta...
2
2047
by: -Karl | last post by:
Couls someone please advise me on this error. What I am trying to do is be able to convert an XML document into arrays. I read that the subs & functions have to be in <scripttags. Thanks! ...
5
2922
by: Nike1984 | last post by:
I'm fairly new to Javascript and it's more of a guessing game for me... I'm trying to build an app for Google Maps and just had some issues recently. First off I just wanted to say that everything...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.