Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5964753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:29:26+00:00 2026-05-22T19:29:26+00:00

I find it weird to use context.Server.MapPath every time just to determine physical location

  • 0

I find it weird to use context.Server.MapPath every time just to determine physical location of some known directory/file under app_data folder. I have an understanding that once an application is running, it must not be possible to have its physical location be changed without first shutting it down. If this is true, then I can cache physical path of app_data on application_start and use the cache value for its execution lifetime!

I need experts opinion on this matter. Is my assumption right? there’s no possibility of changing the physical path of an application without restarting it, right?

If this is true, It will save me tons of time from having to include context as a parameter in every odd method!

Clarity of the method interface is most important to me, and <context> just doesn’t fit into that.

BTW, I’m using shared hosting so I have no control on application physical placement. Does this matter?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:29:27+00:00Added an answer on May 22, 2026 at 7:29 pm

    The path is relative to the current request, so MapPath("foo") might have a different result on requests at different urls. However, if your path is relative to the app-root ("~/foo") or relative to the site-root ("/foo") you can pretty much cache to your heart’s content.

    There is perhaps an edge-case scenario of people adding virtual directories inside IIS during execution, but that is vanishingly unlikely, and is pretty-much going to cause pain anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Every time I try to instantiate a certain model and use it, like for
I'm trying to use yahoo placefinder on my website to find people's location, but
Weird question, but i need to find an answer. Is there any way, in
Well this is a really weird issue, I really didn't find anything on this
WOW! That's a weird title, but I'm happy you're looking, cause I couldn't find
Here's the situation. function scrollLog(line) { // Assume Firefox // alert(weird); frames['log'].find(line); }; Here's
Whenever I find IE is displaying my website weird (different from chrome and firefox),
I keep getting this weird output from my code everytime I use the 'start
The title may seem a little weird but what I find around the internet
I have a weird error, I am not able to find a force close

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.