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

Equivalent AppDomain.CurrentDomain.BaseDirectory

JJ
Hi,

What's the equivalent for AppDomain.CurrentDomain.BaseDirectory in asp.net?
Trying to access web app directory for reading and writing xml files.

Thanks,

JJ
Nov 19 '05 #1
7 4560
Have you looked at Server.MapPath?

string s = Server.MapPath( "default.aspx" );

s, on my machine, is "C:\inetpub\wwwroot\tempasp\default.aspx"

bill
"JJ" <JJ@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
Hi,

What's the equivalent for AppDomain.CurrentDomain.BaseDirectory in asp.net? Trying to access web app directory for reading and writing xml files.

Thanks,

JJ

Nov 19 '05 #2
Hi JJ,

If you're looking for the path of the Web app's directory, you could get it
like this:

Label1.Text = Server.MapPath("")

Is that what you meant?

Ken

'
"JJ" <JJ@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
Hi,

What's the equivalent for AppDomain.CurrentDomain.BaseDirectory in
asp.net?
Trying to access web app directory for reading and writing xml files.

Thanks,

Nov 19 '05 #3
string AppDirectory = Server.MapPath("\");

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"JJ" <JJ@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
Hi,

What's the equivalent for AppDomain.CurrentDomain.BaseDirectory in
asp.net?
Trying to access web app directory for reading and writing xml files.

Thanks,

JJ

Nov 19 '05 #4
JJ
Ok Im running this on my Dev machine which gives me a false path. I am
debugging so what happens is when I use Server.MapPath it shows me
"C:\localhost\websitename\ " which really isn't where the files are for
project.
So how can I get this to work so I can debug on dev machine?

Thanks,

JJ
"William F. Robertson, Jr." wrote:
Have you looked at Server.MapPath?

string s = Server.MapPath( "default.aspx" );

s, on my machine, is "C:\inetpub\wwwroot\tempasp\default.aspx"

bill
"JJ" <JJ@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
Hi,

What's the equivalent for AppDomain.CurrentDomain.BaseDirectory in

asp.net?
Trying to access web app directory for reading and writing xml files.

Thanks,

JJ


Nov 19 '05 #5
Try using Request.PhysicalApplicationPath.

That should return the root directory of your application.

bill

"JJ" <JJ@discussions.microsoft.com> wrote in message
news:D3**********************************@microsof t.com...
Ok Im running this on my Dev machine which gives me a false path. I am
debugging so what happens is when I use Server.MapPath it shows me
"C:\localhost\websitename\ " which really isn't where the files are for
project.
So how can I get this to work so I can debug on dev machine?

Thanks,

JJ
"William F. Robertson, Jr." wrote:
Have you looked at Server.MapPath?

string s = Server.MapPath( "default.aspx" );

s, on my machine, is "C:\inetpub\wwwroot\tempasp\default.aspx"

bill
"JJ" <JJ@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
Hi,

What's the equivalent for AppDomain.CurrentDomain.BaseDirectory in

asp.net?
Trying to access web app directory for reading and writing xml files.

Thanks,

JJ


Nov 19 '05 #6
JJ,

Use :

Request.ServerVariables("APPL_PHYSICAL_PATH")

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"JJ" <JJ@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
Hi,

What's the equivalent for AppDomain.CurrentDomain.BaseDirectory in
asp.net?
Trying to access web app directory for reading and writing xml files.

Thanks,

JJ

Nov 19 '05 #7
That will do it, allright.
So will Request.ServerVariables("APPL_PHYSICAL_PATH")

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"William F. Robertson, Jr." <th****@nameht.org> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Try using Request.PhysicalApplicationPath.
That should return the root directory of your application.
bill "JJ" <JJ@discussions.microsoft.com> wrote in message
news:D3**********************************@microsof t.com...
Ok Im running this on my Dev machine which gives me a false path. I am
debugging so what happens is when I use Server.MapPath it shows me
"C:\localhost\websitename\ " which really isn't where the files are for
project.
So how can I get this to work so I can debug on dev machine?

Thanks,

JJ
"William F. Robertson, Jr." wrote:
> Have you looked at Server.MapPath?
>
> string s = Server.MapPath( "default.aspx" );
>
> s, on my machine, is "C:\inetpub\wwwroot\tempasp\default.aspx"
>
> bill
>
>
> "JJ" <JJ@discussions.microsoft.com> wrote in message
> news:4B**********************************@microsof t.com...
> > Hi,
> >
> > What's the equivalent for AppDomain.CurrentDomain.BaseDirectory in
> asp.net?
> > Trying to access web app directory for reading and writing xml files.
> >
> > Thanks,
> >
> > JJ
>
>
>


Nov 19 '05 #8

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

Similar topics

0
by: Matt Calhoon | last post by:
Hi there, I have a web application that I need to move to a new webfarm. This application uses AppDomain.CurrentDomain.BaseDirectory to call up the base path (D:\content\clientwebsiteroot\) when...
0
by: Matt Calhoon | last post by:
Hi there, Im in the process of moving 200 odd websites to a new webfarm. This webfarm consists of several web servers that access a separate dedicated hardware storage device (Network Appliance...
2
by: Foehammer | last post by:
Hello, I'm trying to load an assembly dynamically using an app domain. This is a proof-of-concept for a larger project, so please excuse the lame class names. TestLib is the dll where all the...
0
by: JonS. | last post by:
Hey All, I'm currently working on a program that dynamically loads assemblies from a directory each into their own seperate AppDomains using a somewhat logical extension of Eric Gunnerson's...
1
by: George Nevsky | last post by:
My ASP.Net application installed in IIS virtual folder which points to some shared folder on network. Everything works fine except AppDomain.CurrentDomain.BaseDirectory method. It returns...
4
by: Jim | last post by:
I am writing a Windows Service in VB.Net, and right upfront I need to pass the path to my config.xml file to the constructor of the class which reads it. In the old days, App.Path & "\config.xml"...
5
by: Benny Raymond | last post by:
What should I do instead of this: AppDomain.CurrentDomain.AppendPrivatePath(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + @"\plugins"); now that...
12
by: John | last post by:
I have a AppDomain ID, how do I get the instance of the AppDomain Object? Please advice. Thanks in advance. John
1
by: ThunderMusic | last post by:
Hi, (My code is at the end of this post) I have an AppDomain that must load a simple assembly that has only one class with one method and it does not work... I receive this exception : "Could...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
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,...

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.