473,387 Members | 1,621 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.

Translate virtual ~ path in app_code codebehind

I need to take a virtual path say "~\Site\Default.aspx" and convert it into
the correct site path in the app_code folder for codebehind. how do you go
about doing it at this level? I found it very easy to do it on a user
control and web page by using the system.web.ui.page.resolveurl function,
but unsure how to do a similar fask at the code level in the app_code
folder. Any ideas? thanks!
Jun 20 '06 #1
1 1652
Server.MapPath will do it for you.
if (HttpContext.Current == null)
{
throw new Exception("Method must be called from a web context");
}
HttpServerUtility server = HttpContext.Current.Server;
server.MapPath(address);

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Smokey Grindle" <no********@dontspam.net> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
I need to take a virtual path say "~\Site\Default.aspx" and convert it into
the correct site path in the app_code folder for codebehind. how do you go
about doing it at this level? I found it very easy to do it on a user
control and web page by using the system.web.ui.page.resolveurl function,
but unsure how to do a similar fask at the code level in the app_code
folder. Any ideas? thanks!

Jun 20 '06 #2

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

Similar topics

0
by: SimpleSimple | last post by:
My company has an IIS 5, ASP.net intranet site that contains documents for employee use. The files are of various types (most often Office) and are stored in blob fields in a SQL2000 database. ...
5
by: WT | last post by:
Hello, I have my code pages in App_Code\Subdir\ *aspx..cs folder, the coresponding aspx are in \Subdir\*.aspx . Compiler can't find the aspx when compiling the aspx.cs and generates error...
3
by: Bob Peek | last post by:
I would like to share code between several web sites that exist as virtual directories under a single site. It appears that I have to create an app_code directory under each virtual root in order...
5
by: sck10 | last post by:
Hello, I am trying to add the following to a App_Code class. The error I am getting references "Page.Controls". I would like to call this from my content page which uses MasterPages I read...
5
by: sck10 | last post by:
Hello, I am converting a class in the App_Code folder from c# to vb and am having problems calling the sub procedure. I have created a Sub called HidePanels in the class "General". When I try...
2
by: pradeep_TP | last post by:
Hello, I am trying to use APP_CODE folder for all my class files under VS 2005. After adding APP_CODE in the solution explorer, I added a new web page by right clicking project and selecting add...
9
by: rn5a | last post by:
Is putting a VB class file in the special directory named App_Code the same as relocating the VB class file from the App_Code directory to another directory & then using the VBC tool, compiling the...
1
by: netasp | last post by:
hi all, when adding a new web form in VS 2003, usually viewing the code behind for that form will let you write any method or function and referencing any web control placed on the form without...
8
by: David C | last post by:
Is the sample below valid for referencing a virtual folder named OracleFiles in a web site where the aspx page that is using this code is under the root folder of the subweb? Some users are...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
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,...

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.