Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

common Application Path

Status
Not open for further replies.

raghu3

Programmer
Dec 19, 2005
96
US
I am creating a generic class which will be used from asp.net console apps and web apps.
I need to use something like Application.Path so that I can have only 1 copy of the class.
I do not want to have the same copy at 2 places with just a path different:
for console apps, it will be the application path
for web based, it will be Any advise ?
 
Well the class can't know what type of application is going to use it unless you tell it, so why not create a property especially for this purpose and return the path based on the value that was set. It could also have a default path unless told otherwise.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Can I do something like in VB: application path, where in the class expects from the current directory where it is running.
 
>> where in the class expects from the current directory where it is running.

checkout the Request object. ur class can access it using:

HttpContext.Current.Request

The request object can give u the path of the currently executing page file...

Known is handfull, Unknown is worldfull
 
work around:
overloaded the method. Default path for web apps and send the path for rest.
This way I have a common repository.
-raghu1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top