473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

<base> tag and PostBack

SJ
Hi,

I have a problem with the HTML <base> element, URL re-writing and Postback.
We are using URL re-writing on the server, and I'd like to use the base
element to make the URLs in the ASPX pages more maintainable. Otherwise, we
have to manually output the application root eg. src="<%= AppRoot %>". This
is cumbersome and hard to maintain.

However, there seems to be no way - apart from a client-side script - to
rewrite the action attribute of the form to handle the full path to the
file. Does anyone know if there is a better way to achieve re-writing of the
action attribute so that it automatically handles the full path?

Thanks

Simon
Nov 17 '05 #1
3 4555
Hi Simon,

I am not very clear on what concern you have. If you want to change the
Action attribute of the Form tag, I have to tell you that in ASP.NET, a web
form can only be submitted to itself. As a sequence, the Action attribute,
by default was set to the current web page itself, and in such case, no
full or absolute path is necessary.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #2
SJ
Hi Jacob,

Thanks for your reply. The problem is that the browser interprets the URL
specified in the action attribute with respect to the base tag - it's as if
the HREF attribute of the base tag is physically inserted in the action
attribute. So, if we have the following tags in an ASPX
mybase/myapp/default.aspx:

<base href="http://mybase">
<form action="default.aspx">

the form data will be POSTed to http://mybase/default.aspx - which is wrong.
I could make the base http://mybase/myapp but that invalidates the point of
using base.

What I'd like to do is to override the action attribute, replacing it with a
fully qualified path - or have ASP.NET do that for me!

Thanks

Simon
"Jacob Yang [MSFT]" <ji***@online.microsoft.com> wrote in message
news:Fw**************@cpmsftngxa06.phx.gbl...
Hi Simon,

I am not very clear on what concern you have. If you want to change the
Action attribute of the Form tag, I have to tell you that in ASP.NET, a web form can only be submitted to itself. As a sequence, the Action attribute,
by default was set to the current web page itself, and in such case, no
full or absolute path is necessary.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #3
Hi Simon,

Thanks for your clarification.

To implement your task, we can override the Render event of the base web
page, where we can replace the action with the full qualified URL. For
example,

Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Dim sb As StringBuilder = New StringBuilder()
Dim sw As StringWriter = New StringWriter(sb)
Dim htw As HtmlTextWriter = New HtmlTextWriter(sw)
MyBase.Render(htw)
Dim html As String = sb.ToString().Replace("dropdownlist.aspx",
"http://localhost/dropdownlist.aspx")
writer.Write(html)

End Sub

Here, we replace the dropdownlist.aspx, which the name of current web page.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #4

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

Similar topics

7
by: Weston C | last post by:
I'm trying to get the href attribute from the base tag in the document head. The following does not seem to work... any ideas what I'm doing wrong? if(!(document.getElementsByTagName) ||...
2
by: CD | last post by:
Is this possible: class base; class derived; //:public base vector <base*> bList; vector<derived*> dList; //add some derived class pointer entries to dList;
2
by: Siemel Naran | last post by:
This code fails compile std::auto_ptr<Base> f() { std::auto_ptr<Derived> out(new Derived()); return out; } There is ambiguity between a templated constructor and templated operator...
3
by: Gilbert Saint-Flour | last post by:
Hello: I have this one line of PHP code which I'd like to convert to Javascript. The PHP code conditionally issues a BASE statement when the html page is called with a frame name, e.g....
1
by: Chris Sharman | last post by:
I'm seeing quite a few 404 errors, all from an agent/browser which calls itself "Mozilla/4.0 (compatible; BorderManager 3.0)". They appear to be from a built page like...
0
by: emma_middlebrook | last post by:
Hi Hopefully the title is quite accurate but here's some more information. I have a load of ICollection<references hanging off a class e.g. ICollection<X>, ICollection<Yetc etc. Each of the...
3
by: yan | last post by:
Hello everybody, I am new so this is the occasion to say hello to everybody. I have a problem with absolute/relative paths. I have to create a static documentation in html for a project and I have...
16
by: call_me_anything | last post by:
why is the following not allowed : vector <Base *vec_of_base; vector <Derived *vec_of_derived; vec_of_base = vec_of_derived; Note : The following is allowed :
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.