Three way to form URI for REST Services


In this article, I will show how we could construct URI in three ways.

Method # 1: Creating URI from string

I am passing string in constructor of URI class, to create new URI.




Method #2 New URI from Component Instance

I am here taking host and path individually and then combining them in constructor of Uri class.




Method #3 Creating URI using Try Pattern validation

In this , I am showing you how could we use Try Pattern method of URI class to construct an URI.




The full source code for your reference is given below


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Net;

namespace ConsoleApplication5


class Program


static void Main(string[] args)


#region Creating URI from string

string url =”;

Uri uri = new Uri(url);




#region Creating URI from Component Instance

string host =”;

string path = “/feed”;

Uri uri1 = new Uri(host);

uri1 = new Uri(uri1, path);




#region Create New URI Try Pattern Validation

string url =”;

Uri uri2;

if(Uri.TryCreate(url,UriKind.Absolute , out uri2))










Report on Community Tech days event Ahmadabad on 24th July 2010

Very first I would thank PINAL DAVE sir and his family  for his great support .  How beautifully and kindly his family supported and welcome me. Thanks is a small word for that.


It was a rainy morning and some political problem in Gujarat, so I thought there won’t be many audiences. When, I reached the venue, I got amazed seeing the crowd. It was around 300 to 350 (approximately). People were in queue with their notes and hall tickets. I saw them and I got excited seeing the enthusiasm of the crowd. Even if, I was the first time in Gujarat, I did not feel that I am stranger here. Whoever was meeting saying Hi and greetings?

Key Note: 10.15 am to 10.30 am by Pinal Dave

Welcome and Key note by Pinal Dave.” He is a great speaker and people want to listen him”, I have been listening this since long but first time, I got a chance to listen to him. He just gave a perfect opening to perfect crowd. With his very own style of speaking, he ignited the audience with excitement ahead in the day. Crowd was almost the twice than the seating chairs in the room. But how easily, he managed everything with the event organizers and put more chairs and everyone got seat. He spoke about, how Microsoft technology in changing day to day life of developers and so user also. He spoke about how Ahmadabad user group (SQL Server and .Net) is working to help the community. Then he introduced the agenda of the day and talked about the speakers. By his unique way of explaining the things, audience got very excited and stage was set for the day.

Session #1 Spatial Data Base-The Indexing Story, 10.30 to 11.30 by Pinal Dave


In this session, Pinal Dave talked about Spatial Data Base. If I say he is a great speaker then that would be nothing something new I would be saying. He was the first speaker of the day and as expected he gave a great opening. The way he explained the pronunciation of SPATIAL to drawing Monalisa with spatial type was more than awesome. His way of connecting technology to real time example was very impressive and very effective too. His humors between the sessions were really nice. He is true speaker who can make audience awake for full of the session.

He explained about

1. Spatial database

2. Why we need that?

3. Polygons in Spatial type

4. How to find distance between two cities and many more

Note: He explained many things but since my session was just after him, so I was not very attentive in his session. He explained much more thing than I listed above

Follow Him:

Read Him:

Session # 2 Introduction to ODATA and WCF Data Service, 11.30 to 12.30 by Dhananjay Kumar


This session delivered by me. You can download the PPT from here

Session # 3 File Stream in SQL Server 2008, 12.30 to 1.30 by Jacob Sebastian

I do not have much understanding of SQL Server but after this session, I was clear with why I need file stream. The way he explained, it was like, I was listening some story. The fun part of his session was, he divided audience in 2 groups and then started why we need File Stream and all. His presentation was reaching to all audience regardless of their background. Very slowly, he started and point by point he explained each thing to audience.

He explained

1. Why we need File Stream

2. Difference between Buffering and Streaming

3. Live demo of using File Stream and many more

Follow Him:

Read Him:

Lunch Break: 12.30 to 1.30

Very first lunch was awesome. After 3.30 hr of session, people gathered for the lunch. Participant was very curious about knowing the technology. Many participants came and talked to speakers about their queries and questions. People were very lively and enjoying the food.

Session#4 MVVM pattern in Silverlight 4.0, 2.30 to 3.30 by Prabhjot Singh bakshi


His session was just after lunch and his level of energy on dais made the audience like, it was the prime session of the day.

Before attending his session, I had a feeling that Model –View-View –Model pattern is next to impossible to understand in an hour. But he proved my feeling wrong with his great way of explanation and all audience was known to MMVM at the end of his session. He is a story teller. The way he started with “What is SilverLight” to ended with a full application running “without a code behind was awesome “. He is professional and each statement from his mouth was testifying that. He was highly energetic.

He demonstrated

1. How to create your first Silver Light 4.0 application

2. How to achieve two way binding.

3. How to achieve ICommand pattern

4. How to use static resources.

Session #5 MS Office 2010 talking to Windows Azure – Developer paradise, 3.30 to 4.45 by Mahesh Devjibhai Dhola


This session was all about integration between Outlook addin + WCF + Twitter API + Azure. The way Mahesh explained these four very different topics was awesome. What was good about this session was, he wrote each bit of the code in front of the audience. It gave a feeling to audience to connect with such an advance topic. His way of showing latest things of azure in a simple term to audience was really impressive.

He demonstrated,

1. How to write outlook add in

2. How to create WCF Service Web Role and host in Azure

3. How to use Twitter API to post tweets.

4. Calling of WCF Service on event of Outlook add in.

Follow Him:

Read Him:

Thanking notes, 4.45 to 5.00 by Mahesh Devjibhai Dhola

Speaking at Community TechDays, Ahmedabad – July 24, 2010

What is Microsoft Community Tech Days?

This is unique program from Microsoft and local user group to enable developers and IT pro to get information about latest technologies from Microsoft.


As of Community tech days official site,

Dive deep into the world of Microsoft technologies at the Community TechDays and get trained on the latest from Microsoft. Build real connections with Microsoft experts and community members, and gain the inspiration and skills needed to maximize your impact on your organization while enhancing your career. What more… you can watch some of these sessions LIVE online from the comfort of your workstation as well.

Event registration can be done

Here for online participation

Here for in person participation

Ahmedabad Community Tech Days event

I am speaking at Ahmedabad tech day’s event.

Event Detail

When: 24th July 2010

Where: Ahmedabad Management Association, AMA Complex, ATIRA, Dr. Vikram Sarabhai Marg.

Target Audience: IT Professionals and Software Developers

Timing: 9.45 am to 5.00 pm

Find detail agenda here


There will be five speakers presenting different topics

Pinal Dave You can see details of his speaking here

Jacob Sebastian

Mahesh Dhola

Prabhjot Singh Bakshi

Dhananjay Kumar

My Speaking detail

When: 4.00 pm to 4.45 pm

Topic: Introduction to ODATA and WCF Data Service


Summary: ODATA is HTTP or web protocol to querying or manipulating data. ODATA uses HTTP, JOSN or ATOM.ODATA can be implemented through any platform supports, HTTP, XML or JSON.ODATA can expose data/information from relational database, File systems, Web sites, services etc.

WCF Data Service is a framework to expose CRUD operation as REST service on a data model.

In session, I will show;

1. How to create WCF Data service on ADO.Net Entity Model.

2. How to create WCF Data service on LINQ to SQL Class.

3. How to consume console application.

4. Paging, URI Options etc.

5. How to consume in Windows 7 Phone application.

So, I welcome you in the session.