Archive for April, 2012

ASP.Net menu control not working in Chrome & Safari Browsers

April 30, 2012 1 comment

  1. In  Solution Explorer right click your application and add the “ASP.Net Folder”App_Browsers if you don’t already have it.
  2. Add a New “Browser File” item to this special folder and call it safari.browser.
  3. Delete all default coding in this file and replace it with the following:
    <browser refID=”safari1plus”>
    <adapter controlType=”System.Web.UI.WebControls.Menu” adapterType=”” />
  4. check in safari and chrome.

If this help you , give feedback it make me write more on day to day problem faced by us programmer

Categories: ASP.NET, ASP.NET MVC Tags: ,

ASP.NET MVC View Model Patterns

April 24, 2012 Leave a comment

In ASP NET MVC There are three basic concept essential to know is Model ,View,Controller.

  • Model:It  Represent  data in application , you can implement validation , business logic over here.
  • Controller: It handle input data from client or user, modifies data in you application , generate view , call view , you can say it manage overall flow in the application .
  • View: it represent visual representation in you application , this is simply a page you see in browse

Now there is a need of passing data from controller to View , for this purpose you can use View Data dictionary, strongly typed process of passing data .but both mechanism have some limitation. With View Data you can pass data in small amount , even you pass complex data using this but this is not suitable for this purpose.Using strongly typed process of passing data view can represent only one domain or class . Now if you want displaying data from multiple domain in single view then you have to modify the domain again that is not the best practice to do that’s  where  View Model is useful.

ViewModel is not really a new pattern. You may have also heard of a Data Transfer Object or DTO. The idea of a DTO object’s purpose in life is to shuttle data from one layer to another. Think of this as a contract between two layers. As long as the contract doesn’t need to
change, code in a specific layer can be refactored all day long with limited ripple effect throughout your code.

I hope this will be helpful for you in understanding the ViewModel concept . if there are any missing or wrong concept in it then your feedback is welcome.

Thanks for reading this article , and yes , be tuned for new article on MVC, ENTITY FRAMWORK ,WCF.

Categories: ASP.NET MVC Tags:

ASP.NET MVC: Razor’s Parsing Algorithm for Code Nuggets

April 23, 2012 Leave a comment

In ASP.NET MVC , there is view engine called Razor that is very easy compared to ASPX view engine . it allow you to code within aspx html fully utilizing your C# and skill , more details of its uses syntax. you can follow this link of Scott Guthrie

The below algorithm captures the core parsing logic we use to support “@” expressions within Razor, and to enable the implicit code nugget scenarios above:

  1. Parse an identifier – As soon as we see a character that isn’t valid in a C# or VB identifier, we stop and move to step 2
  2. Check for brackets – If we see “(” or “[“, go to step 2.1., otherwise, go to step 3
    1. Parse until the matching “)” or “]” (we track nested “()” and “[]” pairs and ignore “()[]” we see in strings or comments)
    2. Go back to step 2
  3. Check for a “.” – If we see one, go to step 3.1, otherwise, DO NOT ACCEPT THE “.” as code, and go to step 4
    1. If the character AFTER the “.” is a valid identifier, accept the “.” and go back to step 1, otherwise, go to step 4
  4. Done!
Categories: ASP.NET MVC Tags:

Web Services vs WCF services

April 5, 2012 5 comments

Many times I saw asking differences between web services and WCF services so this made me write this.

There are numbers of differences between both , so lets understand step by step.

–WCF offers much more flexibility and portability to develop a service when comparing to web service. Still we are having more advantages over Web service.
more more details you can visit at[^]

Features Web Service WCF
Hosting It can be hosted in IIS It can be hosted in IIS, windows activation service, Self-hosting, Windows service
Programming [WebService] attribute has to be added to the class [ServiceContract] attribute has to be added to the class
Model [WebMethod] attribute represents the method exposed to client [OperationContract] attribute represents the method exposed to client
Operation One-way, Request- Response are the different operations supported in web service One-Way, Request-Response, Duplex are different type of operations supported in WCF
XML System.Xml.serialization name space is used for serialization System.Runtime.Serialization namespace is used for serialization
Encoding XML 1.0, MTOM(Message Transmission Optimization Mechanism), DIME, Custom XML 1.0, MTOM, Binary, Custom
Transports Can be accessed through HTTP, TCP, Custom Can be accessed through HTTP, TCP, Named pipes, MSMQ,P2P, Custom
Protocols Security Security, Reliable messaging, Transactions

hope this will help you to understand.

If this help you in understanding the concept then like and share it to your friends.

Categories: WCF Tags:
%d bloggers like this: