Hi all,
I have a problem which I don't understand with the "~" mark in a
NavigateUrl property of an asp:HyperLink. I have this in a master page,
to build the standard menu (rMenuItems is a Repeater):
Protected Sub rMenuItems_Item DataBound(ByVal sender As Object, ByVal e
As System.Web.UI.W ebControls.Repe aterItemEventAr gs)
If e.Item.ItemType = ListItemType.It em Or e.Item.ItemType =
ListItemType.Al ternatingItem Then
CType(e.Item.Fi ndControl("lnk" ), HyperLink).Navi gateUrl =
DataBinder.Eval (e.Item.DataIte m, "Url")
End If
End Sub
It works well, if the url in the browser is at root. Example, if I am
at : http://localhost/faq.aspx, it works.
As soon as I am not in the root directory, e.g.: http://localhost/test/test.aspx, the links now all point to a location
in the subfolder. e.g.: the link who was mapped with "~/default.aspx"
points at http://localhost/test/default.aspx in the browser.
Anyone knows the correction for this one?...
thanks!
ibiza 7 2796
I think that "~" is not very useful.
Better use: "~/"
i.e. "~/default.aspx" instead of "~default.a spx"
"ibiza" <la******@gmail .com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . Hi all,
I have a problem which I don't understand with the "~" mark in a NavigateUrl property of an asp:HyperLink. I have this in a master page, to build the standard menu (rMenuItems is a Repeater):
Protected Sub rMenuItems_Item DataBound(ByVal sender As Object, ByVal e As System.Web.UI.W ebControls.Repe aterItemEventAr gs) If e.Item.ItemType = ListItemType.It em Or e.Item.ItemType = ListItemType.Al ternatingItem Then CType(e.Item.Fi ndControl("lnk" ), HyperLink).Navi gateUrl = DataBinder.Eval (e.Item.DataIte m, "Url") End If End Sub
It works well, if the url in the browser is at root. Example, if I am at : http://localhost/faq.aspx, it works.
As soon as I am not in the root directory, e.g.: http://localhost/test/test.aspx, the links now all point to a location in the subfolder. e.g.: the link who was mapped with "~/default.aspx" points at http://localhost/test/default.aspx in the browser.
Anyone knows the correction for this one?...
thanks!
ibiza
Hi, thanks for the reply. This is however exactly how I use it...
Actually, my problem is that the tilde does not seem to point at
the root of the application, which is what I want. To clarify, if I am
on a page at the root, like http://localhost/index.aspx, my menu link
which has the NavigateUrl as "~/faq,aspx" correctly points at http://localhost/faq.aspx, which is correct in that case.
However, as soon as I am in a page in a sub directory, like http://localhost/test/test.aspx, the same link which the NavigateUrl
still is "~/faq,aspx" now points to http://localhost/test/faq.aspx,
which is incorrect.
The tilde does not seem to be taken in count, how is that?
This is how I use it.
Actually, my problem is that the tilde does not seem to point at
the root of the application, which is what I want. To clarify, if I am
on a page at the root, like http://localhost/index.aspx, my menu link
which has its NavigateUrl as "~/faq,aspx" correctly points at http://localhost/faq.aspx, which is correct in that case.
However, as soon as I am in a page in a sub directory, like http://localhost/test/test.aspx, the same link, which the NavigateUrl
is
still "~/faq,aspx", now points to http://localhost/test/faq.aspx,
which is incorrect.
The tilde does not seem to be taken in count, how is that?
ibiza wrote: This is how I use it.
Actually, my problem is that the tilde does not seem to point at the root of the application, which is what I want. To clarify, if I am on a page at the root, like http://localhost/index.aspx, my menu link which has its NavigateUrl as "~/faq,aspx" correctly points at http://localhost/faq.aspx, which is correct in that case.
However, as soon as I am in a page in a sub directory, like http://localhost/test/test.aspx, the same link, which the NavigateUrl is still "~/faq,aspx", now points to http://localhost/test/faq.aspx, which is incorrect.
The tilde does not seem to be taken in count, how is that?
The tilde indeed refers to the root of the application. This can
be the root of the web site, but not always.
If you created a virtual directory, the tilde will refer to that
virtual directory, because that will be considered the root of
the application.
To summarize:
/ refers to the root of the web site ( http://localhost/)
~ refers to the root of the application ( http://localhost/test/ if test is
a virtual directory, http://localhost/ if test is not a virtual directory)
--
Riki
This is not accurate. "~" represents the root of any application,
regardless of where it's located. If you have a subdirectory of a website
that is also configured as an application in IIS, then "~" can be used to
represent that subdirectory in the context of its own IIS application.
For example, if you are in the page http://localhost/fax.aspx and you have a
link to ~/test/test.aspx, the tilde represents the current application, http://localhost; on the other hand, if you are in the page http://localhost/test/test.aspx and you have a link to ~/faq.aspx, since http://localhost/test is also an IIS application, then it assumes that this
is what represents the tilde and thinks that faq.aspx is in the test
subdirectory/subweb.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."
"Riki" <ri**@dontnagme .com> wrote in message
news:Od******** ******@TK2MSFTN GP12.phx.gbl... To summarize: / refers to the root of the web site (http://localhost/) ~ refers to the root of the application (http://localhost/test/ if test is a virtual directory, http://localhost/ if test is not a virtual directory)
ok, thanks for the follow-ups.
But my problem is still present, as in my example, /test is not
configured as an application, in fact the directory does not even
exists! I used a custom error 404 page to redirect correctly, according
to the url (e.g.: if I type http://localhost/faq, I do a
server.transfer to http://localhost/faq.aspx, and if I type http://localhost/test/yeah, I will be redirected to http://localhost/test.aspx?dir=yeah).
To resume, my menu link with its NavigateUrl property set to "~/faq"
(now that I explained that I have custom error page redirection)
correctly redirects me to the correct "http://localhost/faq" page if
the url in my browser is not a subdirectory and redirects me to the
incorrect/inexistent "http://localhost/SUBDIR/faq" page if the url in
my browser contains a subdirectory.
I included an example of a correct and incorrect scenario screenshots,
depending on the url in the browser to help better understand. http://img380.imageshack.us/img380/7554/tilt7om.gif
Hope this is enoughe to solve my problem!
Thanks a lot all for your time
I have *exactly* the same problem. But my problem started one day ago,
when I decided to use the output cache in my web CONTROLS. ¿Are you
using cache?
When you use the OutputCache directive, the first time the urls are
created well. You know, if you are in the root directory, and you have
a link like this "~/test/test.aspx", it will be transformed in
"test/test.aspx". But if you are in a page inside a subdirectory, and
the link is in a control that have been cached....the link won't be
rendered (its got from the cache), so you are using yet
"test/test.aspx" when you need "subdir/test/test.aspx".
Can this be your problem? Are you using cache in any way?
Bye!!!
ibiza ha escrito: ok, thanks for the follow-ups.
But my problem is still present, as in my example, /test is not configured as an application, in fact the directory does not even exists! I used a custom error 404 page to redirect correctly, according to the url (e.g.: if I type http://localhost/faq, I do a server.transfer to http://localhost/faq.aspx, and if I type http://localhost/test/yeah, I will be redirected to http://localhost/test.aspx?dir=yeah).
To resume, my menu link with its NavigateUrl property set to "~/faq" (now that I explained that I have custom error page redirection) correctly redirects me to the correct "http://localhost/faq" page if the url in my browser is not a subdirectory and redirects me to the incorrect/inexistent "http://localhost/SUBDIR/faq" page if the url in my browser contains a subdirectory.
I included an example of a correct and incorrect scenario screenshots, depending on the url in the browser to help better understand.
http://img380.imageshack.us/img380/7554/tilt7om.gif
Hope this is enoughe to solve my problem! Thanks a lot all for your time This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: monte |
last post by:
Hello, I need to parse a tilde delimited file and output it to a
tabbed delimited file. Example file example.txt
data1~data2~data3~data4
data5~data6~data7~data8
I need to extract data2, data4, data6 and data8 from the above file
and output it to a file delimited by tabs:
data2 data4 data6 data8
|
by: MB2 |
last post by:
I have code in a User Control for an image button like this:
<asp:ImageButton id="__0" runat="server" text="Delete"
ImageUrl="~/Images/ImageLibrary/icon_delete.gif" />
This used to work and it would display the image properly.
However, since installing the latest service pack for the .NET
Framework 1.1, the tilde seems to be expanding improperly. The code
that is expanded to shows this:
<input type="image"...
|
by: Shawn |
last post by:
Hi,
For a few years, I have been developing each of my clients websites using a
seperate web site (unique IP) to solve problems with relative URL's between
my local dev station and the production server.
Recently, I have needed to collaborate with other developers using Source
Safe. But, in order to get source safe working properly, you really need to
be working in virtual directories of the default web site.
|
by: mark |
last post by:
I have a procedure that needs to put characters into the current insertion
point of a textbox. This insertion point is not necessarily the end of the
current string so textbox1.text &= "?" won't do.
I have found that using sendkeys does the trick:
Private Sub UserControl11_buttonpress(ByVal text As String) Handles
UserControl11.buttonpress
System.Windows.Forms.SendKeys.Send(text)
End Sub
|
by: Mythran |
last post by:
In other web servers, more specifically apache and even non-web servers you
can use the tilde character to specify the root directory, or home. Before
I go reinventing the wheel (by parsing a tilde in the web controls for iis)
is there a setting that allows similar functionality in IIS?
Thanks,
Mythran
| |
by: ibiza |
last post by:
Hi all,
I have a problem which I don't understand with the "~" mark in a
NavigateUrl property of an asp:HyperLink. I have this in a master page,
to build the standard menu (rMenuItems is a Repeater):
Protected Sub rMenuItems_ItemDataBound(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.RepeaterItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
|
by: otto |
last post by:
Hi, all:
I have a problem with the inclusion of .js files in mu .aspx pages when
using Master Pages. I try to explain it. If I make a web project without
master pages I simply put in the head tag on each page the reference to the
..js file I want to use. Because I want client side includes I make the
reference with <script> tag, for example:
<head runat=server>
<script src="/javascript/test.js" />
</head>
|
by: jbolty |
last post by:
There have been a few threads talking about using the tilde ~, to
reference the webroot path. My problem though is handling an unexpected
tilde in a url.
this url:
http://localhost/mysite/~Default.aspx
returns this error:
|
by: Frederick Gotham |
last post by:
The "toupper" function takes an int as an argument. That's not too
irrational given that a character literal is of type "int" in C.
(Although why it isn't of type "char" escapes me... )
The "toupper" function imposes a further constrait in that the value
passed to it must be representable as a unsigned char. (If C does not
require all character values to be positive, then again, this constrait
too escapes me... )
Let's say we have the...
|
by: =?Utf-8?B?QWxm?= |
last post by:
Hello all,
I am having trouble dealing with ~(tilde) in my .Net 1.1 web application,
specially when it comes through the URL. For example, when someone requests
the following URL: www.mysite.com/~mypage.aspx, my web application will
through the following error (with custom errors turned off):
Server Error in '/' Application.
--------------------------------------------------------------------------------
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |