473,549 Members | 2,982 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<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 4577
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.m icrosoft.com> wrote in message
news:Fw******** ******@cpmsftng xa06.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.H tmlTextWriter)
Dim sb As StringBuilder = New StringBuilder()
Dim sw As StringWriter = New StringWriter(sb )
Dim htw As HtmlTextWriter = New HtmlTextWriter( sw)
MyBase.Render(h tw)
Dim html As String = sb.ToString().R eplace("dropdow nlist.aspx",
"http://localhost/dropdownlist.as px")
writer.Write(ht ml)

End Sub

Here, we replace the dropdownlist.as px, 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
9196
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) || !(basehrefs = document.getElementsByTagName('base')) || !(basehrefs.length) || !(basehrefs.length > 0) || !(basehrefs.getAttribute) || !(basehref =...
2
1932
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
2093
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 conversion, according to my compiler. Seems there are too many constructors and operator conversions. But this code works:
3
1613
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. href=index2.php?frame2 <html> <head> <? $tag = $_SERVER; if(empty($tag)) {; } else { echo "<base target=$tag>"; } ?> </head>
1
2713
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 http://services.ccagroup.co.uk/upbin/oformw?&whsmithwedding (no referrer supplied, so I can't be certain), which contains <base...
0
1481
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 collection's types are all derived from a base class Base i.e X : Base, Y : Base etc etc.
3
12838
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 to create an index page in every sub-directory. The structure is like the following: / /sources/ /docs/ /docs/doc1 /share
16
2373
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
7715
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7469
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7808
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3498
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1935
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 we have to send another system
0
757
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.