You can use the System.IO.DirectoryInfo class:
DirectoryInfo networkDir=new DirectoryInfo(@"\\Path\here\now\username");
DirectoryInfo twoLevelsUp=networkDir.Parent.Parent;
More Related Contents:
- Compiler Ambiguous invocation error – anonymous method and method group with Func or Action
- parse and execute JS by C#
- Why does the order of alternatives matter in regex?
- How to load the RSA public key from file in C#
- When should I use Lazy?
- Wildcard search for LINQ
- Convert Linq Query Result to Dictionary
- Convert WPF (XAML) Control to XPS Document
- Overloaded method-group argument confuses overload resolution?
- How to detect whether a character belongs to a Right To Left language?
- Regular expression to allow backslash in C#
- Improving/Fixing a Regex for C style block comments
- What Makes a Method Thread-safe? What are the rules?
- C# manual lock/unlock
- How to make make a .NET COM object apartment-threaded?
- How to get current page URL in MVC 3
- The provided URI scheme ‘https’ is invalid; expected ‘http’. Parameter name: via
- How to map JSON to C# Objects
- Which versions of SSL/TLS does System.Net.WebRequest support?
- Compare password hashes between C# and ColdFusion (CFMX_COMPAT)
- Null User on HttpContext obtained from StructureMap
- Getting a list of logical drives
- How to implement a “pure” ASP.NET Core Web API by using AddMvcCore()
- How do i get the path name from a file shortcut ? Getting exception [duplicate]
- RSA read PublicKey
- How to convert JSON to XML or XML to JSON in C#?
- Generic Web Api controller to support any model
- How to generate a CRC-16 from C#
- is there a elegant way to parse a word and add spaces before capital letters
- Using DataAnnotations to compare two model properties