In Focus
Kolkata Chapter Developer Day: May 25
C# Corner Delhi Chapter Meet, May-18, 2013 Official Recap
Istanbul Chapter May 2013 2nd Seminar Announced : Learn WinJS, Windows Store, MVC
ANNOUNCEMENT: April 2013 Month Winners
Email :
Password :
Remember me?
Forgot password
Contribute
An Article
A Blog
A News
A Video
A Link
An Interview Question
Ask a Question
TECHNOLOGIES
.NET 4.5
Current Affairs
Learn .NET
SharePoint 2010
Web Development
.NET Assemblies
Databases & DBA
LightSwitch 2012
SharePoint 2013
Web Services in C#
ADO.NET in C#
Design & Architecture
LINQ
Silverlight with C#
Windows 8
AJAX in C#
Exception Handling C#
Mobile & Embedded
Smart Devices
Windows Azure
Android Programming
Graphics Design
Office 2013
SQL
Windows Controls C#
Articles C#
Hardware
OOP/OOD
SQL Server 2012
Windows Forms C#
ASP.NET Controls in C#
How do I
Operating Systems
Testing
Windows Phone 8
ASP.NET MVC with C#
HTML 5
PHP
TypeScript
Windows Server 2012
ASP.NET Programming
Internet & Web
Products
Visual C#
Windows Store Apps
C# Language
iPhone/iPad
Project Management
Visual Studio .NET
Workflow Foundation in C#
C# Tutorials
Java
Reports using C#
Visual Studio 2010
WPF
C, C++, MFC
Java and .NET
Robotics & Hardware
Visual Studio 2012
XAML
Career Advice
JavaScript, CSS
Security in .NET
WCF with C#
XML
Chapters
JQuery
Request a new Category
|
View All
ANSWERS
BLOGS
VIDEOS
INTERVIEWS
BOOKS
LINKS
NEWS
CHAPTERS
CAREER ADVICE
Making your Web Browser in C#
HTML 5 vs Native Apps
After 3rd C# Corner ISTANBUL Chapter Seminar
Secure Your Android Application from Hackers
Why to fear Object Oriented Programming approach
Check upcoming B'day in Asp.net
Class vs Structure
Happy Birthday Destin Joy
Access Master Page Control In Child Page
Popup Example in WPF
Blog
System.Uri class for getting the relative path
Posted by
Shinuraj
in
Blogs
|
Files, Directory, IO
on
Feb 15, 2011
How to find a relative path based on a base path.
Tweet
3640
0
0
Suppose if we need to find a relative path based on a base path, we can use uri class in system.uri namespace as shown below.
Uri
baseUri =
new
Uri
(basePath);
Uri
fullUri =
new
Uri
(fullPath);
Uri
relativeUri = baseUri.MakeRelativeUri(fullUri);
For example if you are working in a folder called C:\Windows\templates\ and I want to find a relative path for C:\Windows\templates\subdir\test.txt
I want to receive back subdir\test.txt. - In other words always return a non-hardcoded path based on some other known directory.
This Feature is Sponsored By
DynamicPDF Merger is a developers dream for interacting with any existing PDF documents. Merge, append, split, form fill, flatten stamp and so much more.
File Encoding And Decoding In .N..
How to convert your file into binary form?
post comment
COMMENT USING
PREMIUM SPONSORS
iPhone, Android & Web Development Services
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
More Blogs from this Blogger
SQL query to fetch all schema/table names and row/column count inside a database
Silverlight 5.0
Parallel For methods in .net 4.0 System.Threading.Tasks.Parallel static class
SQL case statement for updating multiple rows
SQL PIVOT and UNPIVOT samples
Creating Attribute relationship in SQL cube dimensions
What are SQL Cubes?
IIS 7 HTTP compression
Performance tuning for ASP.NET - Cache static files
When you’ve been "Throwed"
View All
SPONSORED BY
DynamicPDF ReportWriter Suite
PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Follow @twitterapi
Latest Blogs
Get The Value From Datagridview To TextBox On c#
Making your Web Browser in C#
Compare strings using StringComparison.OrdinalIgnoreCase
How to write or create a text file in C#
Binding Text of One controls with another in WPF
Sharepoint 2013 installation failure
How to get thumbnail image from youtube embed code
Server.Transfer Vs Response.Redirect
Leverage “using” in C#
What is DISCO File?
View All
Poll
Result
All Polls
Favorite Computer Manufacturer
Who is your favorite Computer manufacturer?
Lenovo
HP
Dell
Toshiba
Acer
Sony
Who is your favorite Computer manufacturer?
Options
Votes
%
Lenovo
40
10.28
HP
19
4.88
Dell
212
54.50
Toshiba
54
13.88
Acer
48
12.34
Sony
16
4.11
Total
389
100%