473,405 Members | 2,334 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,405 software developers and data experts.

Asp.Net - Web.Config - PhysicalApplicationPath

I am interesting in figuring out how to use the PhysicalApplicationPath method or another equivalent method inside of the Web.Config file. I have a key in my appsettings that looks something like this
<add key="key" value="D:\App\dir\dir" />

Basically I want to be able to use the method to find the path that the web app is sitting in. Which is

D:\App\dir\dir

that way I could define my key as

<add key = "key" value = path />

This seems trivial, but I am not familiar with the intricacies of the web.config file.

To be able to do this would allow users to install the app in different locations and still be able to access the directories under the applications path.

Thanks ahead,

Shocks

Nov 18 '05 #1
1 2258
If I understand you correctly, you want to have other settings in your web.config file which use the path setting that you have set? So these settings need to point to some path or file, and you want to make this work regardless of where the app is installed?

Would you not just be able to use relative paths? In the code behind, when you access these relative paths from web.config, you could always apply the Physical application path to them if necessary. Or you could use URLs, using the '~' syntax to indicate they come from the applications root directory. In codebehind, you can use ResolveURL to convert this to a proper URL, and then convert the URL to the physical path (using Server.MapPath).

I'm not sure if thats what you want to be able to do, as I'm not sure what you mean in your last sentence "To be able to do this would allow users to install the app in different locations and still be able to access the directories under the applications path.". When you say users, do you mean end-users of the app, or developers who are installing the webapp?

Cheers,
Pete Beech

"Shock" <no@waydude.com> wrote in message news:10*************@corp.supernews.com...
I am interesting in figuring out how to use the PhysicalApplicationPath method or another equivalent method inside of the Web.Config file. I have a key in my appsettings that looks something like this
<add key="key" value="D:\App\dir\dir" />

Basically I want to be able to use the method to find the path that the web app is sitting in. Which is

D:\App\dir\dir

that way I could define my key as

<add key = "key" value = path />

This seems trivial, but I am not familiar with the intricacies of the web.config file.

To be able to do this would allow users to install the app in different locations and still be able to access the directories under the applications path.

Thanks ahead,

Shocks

Nov 18 '05 #2

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

Similar topics

4
by: Fuzzyman | last post by:
There have been a couple of config file 'systems' announced recently, that focus on building more powerful and complex configuration files. ConfigObj is a module to enable you to much more *simply*...
0
by: bob | last post by:
I am using Request.PhysicalApplicationPath() to get the current path. I get an error: 'Name Request' is not declared. What am I missing? Bob
1
by: Shock | last post by:
I am interesting in figuring out how to use the PhysicalApplicationPath method or another equivalent method inside of the Web.Config file. I have a key in my appsettings that looks something like...
2
by: cousto D | last post by:
<link href="<%Response.Write(Request.PhysicalApplicationPath)%>/css/toolbar.cs s" type="text/css" rel="stylesheet" > This work fine but the same trix doesn't work into <script> tag like this:...
11
by: TARUN | last post by:
Hello All I need to ask about the configuration file in .NET, There are Two config File 1. Web Config 2. Machine config I understand the the usage of Web config , but not able to understand...
3
by: xeroxero | last post by:
I have several web.config values that I would like to change via a web page within my ASP.NET 2.0 Web Application Project. Is it possible to do so, assuming the ASPNET user has filesystem...
12
by: dbuchanan | last post by:
Hello, (Is this the proper newsgroup?) === Background === I am building a solution with two projects. One project is my data access layer which contains my DataSet as an xsd file. The XSD...
5
by: mmcd79 | last post by:
I built a VB.net application that makes use of a machine level DB connection string setting, and a user level starting location setting. The machine level setting and the default user based...
5
by: =?Utf-8?B?SURD?= | last post by:
Hi, I have a problem accessing files in my ASP.NET 3.5 project after I publish it. When I load a page for the first time Request.PhysicalApplicationPath returns the correct directory...
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,...
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...
0
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...
0
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,...
0
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...

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.