Hi everybody. Do you know what's equal for code "app.patht" in c#.net 2008 ?
I tried "Application.ExecutablePath" and "Application.StartupPath" but they didn't work. I think they have their own name spaces that I havent added them.

Recommended Answers

All 5 Replies

I tried :
string p = Application.StartupPath;

The string p contains the correct startuppath.

I did what you said but this is my error message :
'System.Web.HttpApplicationState' does not contain a definition for 'StartupPath' and no extension method 'StartupPath' accepting a first argument of type 'System.Web.HttpApplicationState' could be found (are you missing a using directive or an assembly reference?)

What is App.Path? Are you looking for the global and user specific configuration files for your application? If that is the case look at the ConfigurationManager class. If not then please explain what you're after in more detail

Use following code

string apppath=Request.ApplicationPath;


string apppath=MapPath("~")

Hi everybody.
I was trying to run code "string p = Application.StartupPath;" in my web application project while it only works in windows applications. So I found this code and it works :
"string RepPath = Server.MapPath("File Name");"
This code returns address of file "File Name"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.