How can I tell if a variable is a virtual or physical path?

Posted on 2008-02-06
Medium Priority
Last Modified: 2012-05-05
Is there any built-in way to tell if a given path is a virtual or physical path?
Question by:bemara57
1 Comment
LVL 11

Accepted Solution

Expert1701 earned 2000 total points
ID: 20833966
You could use the following code, to determine if a path (string PATH_TO_CHECK), is absolute or relative.

  string pathRoot = System.IO.Path.GetPathRoot(PATH_TO_CHECK);
  bool isAbsolute = pathRoot != null && pathRoot.EndsWith("/");

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Suggested Courses

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question