473,386 Members | 1,817 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,386 software developers and data experts.

ASPNET ~ doesn't really work all the time

In Unix the ~ sign is used to refer to the home directory.

And it is quite handy when used in Html pages where we can have it
moved around when deploying in different server.

However, this is not always working in IIS. Did I missed something?
Jun 27 '08 #1
6 836
Hello CKKwan,

Could you demonstrate the sample of what exactly doesnt work?!

---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
CIn Unix the ~ sign is used to refer to the home directory.
C>
CAnd it is quite handy when used in Html pages where we can have it
Cmoved around when deploying in different server.
C>
CHowever, this is not always working in IIS. Did I missed something?
C>
Jun 27 '08 #2
Say for example, in my Master page, I have something like this.

<a href="/Content/Profile.aspx" class="NavMenu">

It works, but if I put a ~ in front.

<a href="~/Content/Profile.aspx" class="NavMenu">, it will appear as:

http://localhost:1234/~/Content/Profile.aspx

And IIS complain that this page cannot be found.

Did I made any mistakes or I have to tell IIS where is my *home*
directory is?

Thanks in advance.

On Jun 10, 11:12*am, Michael Nemtsev [MVP] <nemt...@msn.comwrote:
Hello CKKwan,

Could you demonstrate the sample of what exactly doesnt work?!
Jun 27 '08 #3
The ~/ syntax has nothing to do with IIS. Rather, it is used by many
routines within ASP.NET.

In your example, you're not using the runat="server" attribute and so it is
never even evaluated by ASP.NET. It simply is transferred to the client
unchanged.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

<st*********@gmail.comwrote in message
news:57**********************************@q27g2000 prf.googlegroups.com...
Say for example, in my Master page, I have something like this.

<a href="/Content/Profile.aspx" class="NavMenu">

It works, but if I put a ~ in front.

<a href="~/Content/Profile.aspx" class="NavMenu">, it will appear as:

http://localhost:1234/~/Content/Profile.aspx

And IIS complain that this page cannot be found.

Did I made any mistakes or I have to tell IIS where is my *home*
directory is?

Thanks in advance.

On Jun 10, 11:12 am, Michael Nemtsev [MVP] <nemt...@msn.comwrote:
Hello CKKwan,

Could you demonstrate the sample of what exactly doesnt work?!
Jun 27 '08 #4
re:
!However, this is not always working in IIS. Did I missed something?

~ only works in aspx pages...to reference the root/home directory of an ASP.NET application.
~ doesn't work for html pages.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"CKKwan" <ck****@my-deja.comwrote in message news:2e**********************************@l17g2000 pri.googlegroups.com...
In Unix the ~ sign is used to refer to the home directory.

And it is quite handy when used in Html pages where we can have it
moved around when deploying in different server.

However, this is not always working in IIS. Did I missed something?

Jun 27 '08 #5
~ means application home, BUT only in controls. You cannot simply add it to
a static element. It does not work that way.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
"CKKwan" <ck****@my-deja.comwrote in message
news:2e**********************************@l17g2000 pri.googlegroups.com...
In Unix the ~ sign is used to refer to the home directory.

And it is quite handy when used in Html pages where we can have it
moved around when deploying in different server.

However, this is not always working in IIS. Did I missed something?
Jun 27 '08 #6
Well, it works also in links:

<link type="text/css" rel="Stylesheet" href="~/NewFolder1/Stylesheet1.css"
/>

As the others have said, it will work in controls with runat="server":

<img src="~/NewFolder1/myImage.jpg" runat="server" />
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:B6**********************************@microsof t.com...
>~ means application home, BUT only in controls. You cannot simply add it to
a static element. It does not work that way.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
"CKKwan" <ck****@my-deja.comwrote in message
news:2e**********************************@l17g2000 pri.googlegroups.com...
>In Unix the ~ sign is used to refer to the home directory.

And it is quite handy when used in Html pages where we can have it
moved around when deploying in different server.

However, this is not always working in IIS. Did I missed something?

Jun 27 '08 #7

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

Similar topics

2
by: Dennis | last post by:
The setup: Windows XP Pro Python 2.3 GTK+ 2.2.1.2 and pyGTK 1.99.17 for Python 2.3 from http://www.pcpm.ucl.ac.be/~gustin/win32_ports/ I've downloaded and installed per the instructions the...
10
by: Brett | last post by:
This code is supposed to work in Netscape 4+ and IE 4+. It works fine in IE but in Netscape 7.2, I get a blank page. Any suggestions? Thanks, Brett <html> <head>
3
by: MeNotHome | last post by:
I am trying to automate web browser navigation and form fill out in vb.net Why doesn't this work? AxWebBrowser1.Document.Forms(0).All("action-download").click() I also tried...
13
by: Giggle Girl | last post by:
My pages need to unfold gracefully even if Javascript is disabled, but I can't get this to work? Please help, Javascript Gurus!! <noscript> document.write('<span class=warning><b>Warning</b>:...
2
by: Brett Romero | last post by:
I can't find what exactly I'm doing wrong that the following DataGridTableStyle is not working on my table. The result set returns 21 columns. I'm only formatting 5 via the TableStyle. I thought...
3
by: Joey | last post by:
I am working on an asp.net 1.1 web app in C#. I downloaded some sample code that is supposed to allow for me to persist session state. The code is as follows: private void PersistSessionState()...
16
by: Dustan | last post by:
This is the biggie that has been keeping me from even trying to use C+ + for more than about 10 seconds: it doesn't work. I've been able to get java and (of course) python programs to compile and...
1
by: esource | last post by:
Hi all, has anyone been successful in forcing impersonation of the ASPNET account that calls a component through com interop? I have tried doing it programmatically, through IIS, through the web...
7
by: yawnmoth | last post by:
http://www.frostjedi.com/terra/scripts/demo/xml.html The first alert() shows the XML that the server is returning. The second alert() shows a particular elements nodeValue and, as you can see,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
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
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.