0

Managing url paths can be a real pain in ASP.NET. AbsolutePath vs RelativePath vs etc. drives me crazy. I find that many solutions require the user to edit web.config element to include the correct subfolder path; ex.

Website Root: http://www.domain.com Web.config setting: /

Website Root: http://www.domain.com/blog web.config setting: /blog/

Is there a way to properly handle this without having to make changes to the web.config?

2
  • I /blog configured as a virtual app in IIS or just a sub directory of the web app? Commented Jan 7, 2009 at 3:05
  • This would be the case for a virtual app, such as running BlogEngine.NET under your parent domain site. Ex. www.domain.com/blog would map to your blogengine application folder. Commented Jan 7, 2009 at 3:07

2 Answers 2

2

You could use Request.ApplicationPath. A reference of usage is here.

This way your images folder, for example, will be Request.ApplicationPath + "/images/";

Sign up to request clarification or add additional context in comments.

Comments

1

I think Rick's blog entry helps solve some of my problems...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.