Wednesday, March 7, 2012

Google can tell you that what the world want? Really!

0 comments
I was so boring in night yesterday and playing with Google and found some interesting queries you want to google it! it can really tell you what is people requirement all over the world (you can make profit if you are businessman!)

Just open Google try to type following queries

Sunday, March 4, 2012

Microsoft has released Visual-Studio 2011 beta and Window 8 Consumer preview

0 comments
Microsoft has released 2 great new version of it's products which includes visual stuido 2011 beta which is development environment (IDE) for .net programmer and new version of OS Window8-consumer preview.



Visual Studio 2011 Beta

Jason Zander has first announced regarding release of Visual Studio 11 Beta & .NET 4.5 Beta on his blog post.
Download it from here + Download Visual Studio 2011 Beta 

This time Visual Studio lunched with totally new look combine with many new feathers as below.
  •     Project Compatibility
  •     IDE Productivity Improvements
  •     Search Everywhere
  •     Toolbar Improvements
  •     Additional Tooling
  •     Multiple-Monitor Support
  •     Performance Enhancements
  •     New Project Types
  •     Extensibility    

You can read each & every fether on Visual studio magazine's post about "Inside Visual Studio 11: A Guided Tour".

Scott Hanselman has also written about overview of features available with Visual Studio 2011 beta in his blog post.

Window-8 Consumer Preview

Steven Sinofsky has first made announcement on his blog post of  "Windows 8 – The Consumer Preview" availability for download.if you are in hurry to look inside it then visit this and starting now at http://preview.windows.com.

Read this guidelines before installation

There are lots of post (i think many people rushed out to write about that to be a first blogger to write on this topic!) available on internet about Window 8 features so i don't want to talk about it here.
just google it - Window 8 features :)

Saturday, March 3, 2012

ASP.NET Web API - Great collection of learning resources

0 comments
ASP.NET team launched MVC4 Beta with new asp.net web API template and all .net peoples looking for good resources to learn more about that and build application on that.

I was also searching for that and found good links here with all tutorials, videos and samples.

Tugberk Ugurlu lists a bunch of great resources for getting started with ASP.NET Web API in his blog post, follow below link.


Thursday, March 1, 2012

REST call using json in asp.net with Basic authentication

0 comments
REST (Representational state transfer) is very popular architecture to transfer resource on web. Using HTTP methods (GET, PUT, POST, DELETE),the Internet media type of the data supported by the web service(JSON, XML or YAM etc.) and principles of REST we can build RESTful web service.
 
Today many service provided as restful web service which can easily accessed by any browser on any system with any language.
I would like to give you Example with code here to make post call using json data in asp.net.
we need to add below namespcae for that
  • using System.Net;
  • using System.IO;

WebResponse: Responsible to provide response from URI
WebRequest: Responsible to make request to URI



In above code i made request with basic authentication (In my words: if you'll request service URI with browser and if it will prompt with login box then that service requires basic authentication to access resources ) and try to get response.

you can test your rest call using Fiddler as well before implementation of code to test that web service working is as per expectation.

Important Note :
As per stackoverflow's answer take care about this header Expect: 100-Continue.

"By default, .NET will tag outgoing POST requests with the header Expect: 100-Continue. If the server doesn't support this, it will fail with a 417 error.
To get .NET to not do this, execute the following before creating your WebRequest object:

System.Net.ServicePointManager.Expect100Continue = false;
"

Hope it will be helpful to you!





Extend the built-in ASP.NET DataAnnotations using DataAnnotations Extensions

0 comments
If you have worked with development of web service, silverlight application or mvc applicaiton then you know about DataAnnotations class to validate DTO client side as well as server side.

DataAnnotations contains mostly Required, Range, RegularExpression and StringLength and to see full list of attributes it contains visit this msdn link "Using Data Annotations to Customize Data Classes" .

In my mvc application there is person class (Model) and validation for email as per below (by regular expression)



Scott Kirkland has extended this and created excellent DataAnnotations Extensions pacakge for .net to allow more validation attributes, also he has explained about this in his blog post with examples.

so after installing DataAnnotations Extensions Nuget package i can write email validation as per below





Following are list of more validation attributes available in  DataAnnotations Extensions
  •     CreditCardAttribute
  •     CuitAttribute
  •     DateAttribute
  •     DigitsAttribute
  •     EmailAttribute
  •     EqualToAttribute
  •     FileExtensionsAttribute
  •     IntegerAttribute
  •     MaxAttribute
  •     MinAttribute
  •     NumericAttribute
  •     UrlAttribute
  •     YearAttribute
You can see demo of each & every attributes here.