<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-88887553752935902</id><updated>2012-01-09T03:31:01.579-08:00</updated><category term='WCF 3.5'/><category term='VBScript'/><category term='C#'/><category term='LINQ'/><category term='DateTime'/><category term='MS Access'/><category term='Interview Experience'/><category term='OOPS'/><category term='Asp.Net'/><category term='Sharepoint'/><category term='.Net Framework 3.5'/><category term='Convert'/><category term='Common'/><category term='UML'/><category term='TimeSpan'/><category term='SharePoint Server 2010'/><category term='Workflow Foundation'/><category term='ADO.NET'/><title type='text'>DOT NET TIPS AND TRICKS</title><subtitle type='html'>This blog is dedicated to new technologies of Microsoft, including LINQ, sharepoint, ADO.NET entity framework and lot more</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>79</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-1337179137164769370</id><published>2011-11-01T07:51:00.000-07:00</published><updated>2011-11-01T07:53:54.988-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TimeSpan'/><category scheme='http://www.blogger.com/atom/ns#' term='DateTime'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Convert DATETIME TO TIMESPAN IN C#</title><content type='html'>In the previous post, I mentioned how to convert DATETIME to TIMESPAN.&lt;br /&gt;&lt;br /&gt;Now if the requirement is to convert DATETIME TO TIMESPAN, we can do that in one line:&lt;br /&gt;&lt;br /&gt;DateTime dt="XXX";&lt;br /&gt;TimeSpan TS = new TimeSpan(dt.Now.Ticks);&lt;br /&gt;&lt;br /&gt;This will convert the DateTime to TimeSPan.&lt;br /&gt;&lt;br /&gt;Varun&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-1337179137164769370?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/1337179137164769370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=1337179137164769370' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1337179137164769370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1337179137164769370'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2011/11/convert-tdatetime-to-timespan-in-c.html' title='Convert DATETIME TO TIMESPAN IN C#'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-778638114671004292</id><published>2011-11-01T04:49:00.000-07:00</published><updated>2011-11-01T04:52:55.386-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TimeSpan'/><category scheme='http://www.blogger.com/atom/ns#' term='Convert'/><category scheme='http://www.blogger.com/atom/ns#' term='DateTime'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Convert TimeSpan To DateTime in c# + One line Code</title><content type='html'>We usually fall into the situation where conversion of Timespan to DateTime is required.&lt;br /&gt;&lt;br /&gt;Here is how it can be done easily just by casting:&lt;br /&gt;&lt;br /&gt;Suppose we have two variables DateTime and Timespan and Timespan one with some value&lt;br /&gt;DateTime dt;&lt;br /&gt;TimeSpan ts="XXX";&lt;br /&gt;&lt;br /&gt;We can covnert 'ts' to 'dt' like this:&lt;br /&gt;&lt;br /&gt;dt= Convert.ToDateTime(ts.ToString());&lt;br /&gt;&lt;br /&gt;Thats it!!!&lt;br /&gt;&lt;br /&gt;Hope you have liked the solution.&lt;br /&gt;&lt;br /&gt;Varun&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-778638114671004292?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/778638114671004292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=778638114671004292' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/778638114671004292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/778638114671004292'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2011/11/convert-timespan-to-datetime-in-c-one.html' title='Convert TimeSpan To DateTime in c# + One line Code'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-7902677610049086369</id><published>2010-02-02T20:39:00.000-08:00</published><updated>2010-02-02T20:47:01.920-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MS Access'/><title type='text'>Microsoft Access was unable to create the .accde, .mde or .ade file</title><content type='html'>&lt;strong&gt;Problem &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Many times we faces issue that after creating the MDB file, when we try to compile the database to MDE file ,Access gives the following error :&lt;br /&gt;&lt;br /&gt;Microsoft Access was unable to create the .accde, .mde or .ade file&lt;br /&gt;&lt;br /&gt;On clikcing the button 'Show Help', it shows following error message: &lt;br /&gt;&lt;br /&gt;This error is usually associated with compiling a large database into an MDE file.  Because of the method used to compile the database, a considerable number of TableID references are created for each table.  The Access database engine can only create a maximum of 2048 open TableIDs at one time.  Exporting a database as an MDE potentially can exceed this limit if the database has a large number of objects (table, macro, form, report, etc).&lt;br /&gt;There is no accurate method to estimate the number of TableIDs the Access database engine uses during the process of compiling a database as an MDE.  However, each VBA module and each form uses one TableID, as a result, if the database has 500 forms, and each form's HasModule property is set to Yes, as many as 1,000 TableIDs are used.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The main reason of database not getting compiled to mde is that it failed during comilation. That is , yiu have some code tha failed to compile.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Steps:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. Press Alt + F11 to display VBA editor. &lt;br /&gt;2. In the menu 'Debug' , you will find 1st menu item as 'Compile AccessDb'.&lt;br /&gt;3. Click that option.&lt;br /&gt;4. If there is no error, the database will get compiled.&lt;br /&gt;5. If durong compilation, any error is encountered, the VBA editor will display that error and you can rectifiy that.&lt;br /&gt;6. Once all errors get rectified, you will be able to compile the database. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Once successfully compiled, try makeing the mde again ans it will definitly make the mde file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-7902677610049086369?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/7902677610049086369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=7902677610049086369' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7902677610049086369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7902677610049086369'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2010/02/microsoft-access-was-unable-to-create.html' title='Microsoft Access was unable to create the .accde, .mde or .ade file'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-6155691783048500654</id><published>2009-12-23T01:44:00.000-08:00</published><updated>2009-12-23T01:47:33.277-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MS Access'/><title type='text'>How to reset the autoincrement field in MS Access Table</title><content type='html'>&lt;strong&gt;How to reset the autoincrement field in MS Access Table&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Many times we use autoicrement field in Ms Access table and we have noticed that the value of autoincrement field keeps on increasing ever if we delete all the rows of the table and add new row.&lt;br /&gt;In order to reset the autoincrement field value back to 1, do the following:&lt;br /&gt;&lt;br /&gt;1. Delete all the rows from the table.&lt;br /&gt;2. Compact the whole database .&lt;br /&gt;&lt;br /&gt;This will automatically reset the autoincrement value back to 1.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-6155691783048500654?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/6155691783048500654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=6155691783048500654' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6155691783048500654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6155691783048500654'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/12/how-to-reset-autoincrement-field-in-ms.html' title='How to reset the autoincrement field in MS Access Table'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-4220885947185572714</id><published>2009-12-22T21:30:00.000-08:00</published><updated>2009-12-22T21:35:43.858-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WCF 3.5'/><title type='text'>Introducing WCF 3.5</title><content type='html'>This post is dedicated to WCF and its basics. We will go through various conceptual points of WCF and learn step by step implementation of WCF.&lt;br /&gt;This post will cover few fundamental topics like:&lt;br /&gt;• What is Windows Communication Foundation?&lt;br /&gt;• Advantage of WCF&lt;br /&gt;• What is an endpoint?&lt;br /&gt;• Structure of endpoint or ABC of an end point.&lt;br /&gt;• Explaining Address&lt;br /&gt;• Explaining Binding and type of binding&lt;br /&gt;• How to select proper binding&lt;br /&gt;• Contracts and type of contracts&lt;br /&gt;• Discussing Service Contract in detail।&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is WCF?&lt;/strong&gt;&lt;br /&gt;WCF stands for Windows Communication Foundation and comes along with Dot net framework 3.0 onwards and as a part of operating system from Vista onwards.&lt;br /&gt;Business process in today’s market depends on various systems based on systems that runs on different platform within or outside an organization. There must be a way , a solution to have a communication between these various systems.&lt;br /&gt;&lt;strong&gt;Why to use WCF?&lt;/strong&gt;&lt;br /&gt;WCF basically is a Microsoft’s solution to develop communication between distributed application। One may think why to use WCF when we already have lot of options to develop distributed application in past. The one line answer is that WCF acts as an unified technology that encapsulates all existing technologies to develop distributed application such as .NET Remoting, ASMX, MSMQ etc.&lt;br /&gt;&lt;br /&gt;Apart from that we get lot of option on how to host the WCF service like IIS, or Widows Activated Service (WAS) etc. That we will discuss in later post.&lt;br /&gt;I am eliminating discussion on history of distributed application since distributed application development is such a huge topic that it will divert our objective to learn WCF basics , However, throughout the document, I will map the similarity between existing distributed application solution to WCF।&lt;br /&gt;&lt;br /&gt;Endpoint is the part that a service exposes to the outer system. It defines various details of a service hosted. The consumer reads the endpoint to judge the nature, type of the hosted service.&lt;br /&gt;&lt;strong&gt;The ABC of WCF Endpoint:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Three basic component of any WCF service is :&lt;br /&gt;“A” is for Address: Where to find the service&lt;br /&gt;“B” is for Binding: How to communicate with the service&lt;br /&gt;“C” is for Contract: What to send to the service or what to expect from the service.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Address:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;It defines where on the network messages should be sent so that the endpoint receives them. This is the location to which messages must be sent by the client.&lt;br /&gt;&lt;br /&gt;The address for an endpoint is a unique Uniform Resource Locator (URL) that identifies the location of the service. The address should follow the Web Service Addressing (WS-Addressing) standard, which means it might contain the following four parts:&lt;br /&gt;&lt;br /&gt;• Scheme: The top-level portion of the address, this is typically “http” followed by a colon.&lt;br /&gt;This is not the same thing as a protocol, even though it commonly uses the same letters as the protocol.&lt;br /&gt;• Machine: Identifies the machine name, which can be a public URL or a local identifier.&lt;br /&gt;• Port: The optional port number, preceded by a colon.&lt;br /&gt;• Path: The path used to locate the service files. Typically, this is just the service name, but the path&lt;br /&gt;&lt;br /&gt;Syntax of an address will be: Scheme://Machine[:Port]/Path1/Path2&lt;br /&gt;&lt;br /&gt;Examples:&lt;br /&gt;&lt;br /&gt;http://localhost:8080/Service1&lt;br /&gt;http://localhost/Service1/SubService&lt;br /&gt;http://www.ServiceHost.com/Service1&lt;br /&gt;net.tcp://localhost:1234/OrderService&lt;br /&gt;&lt;br /&gt;WCF supports several protocols, and each has its own particular addressing format.&lt;br /&gt;1. HTTP protocol:&lt;br /&gt;HTTP services can be either self-hosted or hosted on Internet Information Services (IIS). When addressing an HTTP service in a self-hosted scenario, you use the following format:&lt;br /&gt;http://localhost:8080/QuickReturns/Exchange&lt;br /&gt;2. TCP Protocol:&lt;br /&gt;The TCP transport uses the net.tcp: scheme but otherwise follows the same rules as described&lt;br /&gt;for HTTP addresses. Here is an example:&lt;br /&gt;net.tcp://localhost:8080/QuickReturns/Exchange&lt;br /&gt;3. MSMQ:&lt;br /&gt;You can use the Microsoft Message Queue (MSMQ) transport in an asynchronous one-way&lt;br /&gt;(fire-and-forget) or duplex type of messaging pattern and use the MSMQ features of Windows. net.msmq://localhost/private$/QuickReturnSettleTrade&lt;br /&gt;4. Named Pipes:&lt;br /&gt;It is a common way to provide a means to implement inter- or in-process communication.&lt;br /&gt;The Named Pipes transport in WCF supports only local communication and uses the&lt;br /&gt;net.pipes scheme. Port numbers don’t have any meaning with the Named Pipes transport.&lt;br /&gt;This results in the following address format:&lt;br /&gt;net।pipe://localhost/QuickReturns/Exchange&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Binding:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;A binding defines how you can communicate with the service. It is the primary extension point of the ABCs of WCF. The binding controls the following:&lt;br /&gt;&lt;br /&gt;• The transport (HTTP, MSMQ, Named Pipes, TCP)&lt;br /&gt;• The channels (one-way, duplex, request-reply)&lt;br /&gt;• The encoding (XML, binary, MTOM…)&lt;br /&gt;• The supported WS-* protocols (WS-Security, WS-Federation, WS-Reliability, WS-Transactions)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;WCF provides a default set of bindings that should cover most of your requirements. If the default bindings don’t cover your requirements, you can build your own binding by extending from CustomBinding.&lt;br /&gt;&lt;br /&gt;There are nine preconfigured bindings in WCF. Each of these provides the means for a particular distributed computing need. There are several factors that determine which binding to choose for a specific application, including security, interoperability, reliability, performance, and transaction requirements.&lt;br /&gt;&lt;br /&gt;Table below compares the nine preconfigured bindings by showing the common features they support. This table can be used to select a best binding for a particular need.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_AififblDFCg/SzGql4vheYI/AAAAAAAABvI/OsWhbShnYhI/s1600-h/Capture.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5418299394567010690" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 400px; CURSOR: hand; HEIGHT: 359px" alt="" src="http://4.bp.blogspot.com/_AififblDFCg/SzGql4vheYI/AAAAAAAABvI/OsWhbShnYhI/s400/Capture.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Below is the process that will help you to select the binding you required for your application:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_AififblDFCg/SzGqlTd_ZFI/AAAAAAAABvA/fiD9dN7TmIg/s1600-h/capture0.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5418299384561362002" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 400px; CURSOR: hand; HEIGHT: 246px" alt="" src="http://4.bp.blogspot.com/_AififblDFCg/SzGqlTd_ZFI/AAAAAAAABvA/fiD9dN7TmIg/s400/capture0.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Contract:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;A contract is a description of the messages that are passed to and from service endpoints.&lt;br /&gt;&lt;br /&gt;There are three types of contracts in WCF:&lt;br /&gt;&lt;br /&gt;• Service contracts : Service contracts describe the functional operations implemented by the service. A service contract maps the class methods of a .NET type to WSDL services, port types, and operations. Operation contracts within service contracts describe the service operations, which are the methods that implement functions of the service.&lt;br /&gt;&lt;br /&gt;• Data contracts: Data contracts describe data structures that are used by the service to communicate with clients. A data contract maps CLR types to XML Schema Definitions (XSD) and defines how they are serialized and deserialized. Data contracts describe all the data that is sent to or from service operations.&lt;br /&gt;&lt;br /&gt;• Message contracts: Message contracts map CLR types to SOAP messages and describe the format of the SOAP messages and affect the WSDL and XSD definitions of those messages. Message contracts provide precise control over the SOAP headers and bodies.&lt;br /&gt;&lt;br /&gt;We will cover each type of binding and contract as we moves ahead with the implantation of WCF service. All theory will really make all of confuse so we need a bit of coding also..&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explaining Service Contract:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;NOTE: before going into code, I would like to mention that all class, attributes specified to WCF comes from System.ServiceModel namespace. So import this namespace before going for coding.&lt;br /&gt;A service contract is a collective mechanism by which a service capabilities and requirements are specified for its consumers.&lt;br /&gt;Few points regarding Service Contract:&lt;br /&gt;• A service contract can be applied to a normal dot net class or an interface.&lt;br /&gt;• Service contract attribute is not inherited. That means if you are inheriting a class that has service contract attribute to it, you need to define the attribute to the derived class also. It will not get inherited automatically.&lt;br /&gt;• Best practice is to use service contract attribute to interface.&lt;br /&gt;• Always use namespace and Name parameter when defining a service contract attribute.&lt;br /&gt;&lt;br /&gt;Sample Code:&lt;br /&gt;&lt;br /&gt;An interface defined as a service contract without any parameter.&lt;br /&gt;[ServiceContract()]&lt;br /&gt;public interface ITaskManagerService&lt;br /&gt;{ …. }&lt;br /&gt;An interface defined as a service contract without any parameter.&lt;br /&gt;[ServiceContract(Name=”ServiceName”,Namespace=”http://schema.application.com/path1”)]&lt;br /&gt;public interface ITaskManagerService&lt;br /&gt;{ …। }&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explaining Operation Conntract:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;The OperationContractAttribute, also defined in the System.ServiceModel namespace, can be applied only to methods. It is used to declare the method as belonging to a Service contract.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[ServiceContract(Name=”ServiceName”,Namespace=”http://schema.application.com/path1”)]&lt;br /&gt;public interface ITaskManagerService&lt;br /&gt;{&lt;br /&gt;[OperationContract(IsOneWay = true,name=”Operation1”)]&lt;br /&gt;void ProcessInsertMessage(Message message);&lt;br /&gt;}&lt;br /&gt;So the above piece of code displays a interface defined as a service contract and its method as an operation contract।&lt;br /&gt;&lt;br /&gt;In next article, I will discuss Message Exchange Pattern and two other contracts that is Data Contract and Message Contract.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-4220885947185572714?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/4220885947185572714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=4220885947185572714' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4220885947185572714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4220885947185572714'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/12/introducing-wcf-35.html' title='Introducing WCF 3.5'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_AififblDFCg/SzGql4vheYI/AAAAAAAABvI/OsWhbShnYhI/s72-c/Capture.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-7857831175342844099</id><published>2009-11-18T01:50:00.000-08:00</published><updated>2009-11-18T02:05:54.849-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.Net'/><title type='text'>All about Global.asax</title><content type='html'>This file is used by the application to hold application-level events, objects, and variables — all of which are accessible application-wide. Active Server Pages developers had something similar with the Global.asa file.&lt;br /&gt;&lt;br /&gt;Your ASP.NET applications can have only a single Global.asax file. This file supports a number of items.&lt;br /&gt;&lt;br /&gt;When it is created, you are given the following template:&lt;br /&gt;&lt;br /&gt;&amp;LT;%@ Application Language="VB" %&amp;GT;&lt;br /&gt;&amp;LT;script runat="server"&amp;GT;&lt;br /&gt;&lt;br /&gt;Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)&lt;br /&gt;' Code that runs on application startup&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)&lt;br /&gt;' Code that runs on application shutdown&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)&lt;br /&gt;' Code that runs when an unhandled error occurs&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)&lt;br /&gt;' Code that runs when a new session is started&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)&lt;br /&gt;' Code that runs when a session ends.&lt;br /&gt;' Note: The Session_End event is raised only when the sessionstate mode&lt;br /&gt;' is set to InProc in the Web.config file. If session mode is&lt;br /&gt;' set to StateServer&lt;br /&gt;' or SQLServer, the event is not raised.&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&amp;LT;/script&amp;GT;&lt;br /&gt;&lt;br /&gt;Just as you can work with page-level events in your .aspx pages, you can work with overall application&lt;br /&gt;events from the Global.asax file. &lt;br /&gt;&lt;br /&gt;In addition to the events listed in this code example, the following list&lt;br /&gt;details some of the events you can structure inside this file:&lt;br /&gt;&lt;br /&gt;- &lt;strong&gt;Application_Start&lt;/strong&gt;: Called when the application receives its very first request. It is an ideal spot in your application to assign any application-level variables or state that must be maintained across all users.&lt;br /&gt;&lt;br /&gt;- &lt;strong&gt;Session_Start&lt;/strong&gt;: Similar to the Application_Start event except that this event is fired when an individual user accesses the application for the first time. For instance, the Application_Start event fires once when the first request comes in, which gets the application going, but the Session_Start is invoked for each end user who requests something from the application for the first time.&lt;br /&gt;&lt;br /&gt;- &lt;strong&gt;Application_BeginRequest&lt;/strong&gt;: Although it not listed in the preceding template provided by Visual Studio 2008, the Application_BeginRequest event is triggered before each and every request that comes its way. This means that when a request comes into the server, before this request is processed, the Application_BeginRequest is triggered and dealt with before any processing of the request occurs.&lt;br /&gt;&lt;br /&gt;- &lt;strong&gt;Application_AuthenticateRequest&lt;/strong&gt;: Triggered for each request and enables you to set up custom authentications for a request.&lt;br /&gt;&lt;br /&gt;- &lt;strong&gt;Application_Error&lt;/strong&gt;: Triggered when an error is thrown anywhere in the application by any user of the application. This is an ideal spot to provide application-wide error handling or an event recording the errors to the server’s event logs.&lt;br /&gt;&lt;br /&gt;- &lt;strong&gt;Session_End&lt;/strong&gt;: When running in InProc mode, this event is triggered when an end user leaves the application.&lt;br /&gt;&lt;br /&gt;- &lt;strong&gt;Application_End&lt;/strong&gt;: Triggered when the application comes to an end. This is an event that most ASP.NET developers won’t use that often because ASP.NET does such a good job of closing and cleaning up any objects that are left around.&lt;br /&gt;&lt;br /&gt;In addition to the global application events that the Global.asax file provides access to, you can also use directives in this file as you can with other ASP.NET pages. The Global.asax file allows for the following directives:&lt;br /&gt;&lt;br /&gt;- @Application&lt;br /&gt;- @Assembly&lt;br /&gt;- @Import&lt;br /&gt;&lt;br /&gt;These directives perform in the same way when they are used with other ASP.NET page types.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-7857831175342844099?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/7857831175342844099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=7857831175342844099' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7857831175342844099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7857831175342844099'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/11/all-about-globalasax.html' title='All about Global.asax'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-9204030845067118579</id><published>2009-11-18T01:35:00.000-08:00</published><updated>2009-11-18T01:43:25.908-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.Net'/><title type='text'>How to place two classes written in different languages in App_Code</title><content type='html'>What is App_Code ?&lt;br /&gt;&lt;br /&gt;The \App_Code folder is meant to store your classes, .wsdl files, and typed datasets. Any of these items stored in this folder are then automatically available to all the pages within your solution.&lt;br /&gt;&lt;br /&gt;Everything placed in the \App_Code folder is compiled into a single assembly. The class files placed within the \App_Code folder are not required to use a specific language. This means that even if all the pages of the solution are written in Visual Basic 2008, the class in the \App_Code folder of the solution can be built in C#.&lt;br /&gt;Here is a small catch...&lt;br /&gt;&lt;br /&gt;Because all the classes contained in this folder are built into a single assembly, you cannot have classes of different languages sitting in the root \App_Code folder, as in the following example:&lt;br /&gt;&lt;br /&gt;\App_Code&lt;br /&gt;Class1.cs&lt;br /&gt;Class2.vb&lt;br /&gt;&lt;br /&gt;Having two classes made up of different languages in the \App_Code folder causes an&lt;br /&gt;error to be thrown. It is impossible for the assigned compiler to work with two different languages.&lt;br /&gt;&lt;br /&gt;Therefore, in order to be able to work with multiple languages in your \App_Code folder, you must make some changes to the folder structure and to the web.config file.&lt;br /&gt;&lt;br /&gt;The first step is to add two new subfolders to the \App_Code folder &lt;br /&gt;— a \VB folder and a \CS folder. &lt;br /&gt;This gives you the following folder structure:&lt;br /&gt;\App_Code&lt;br /&gt;&amp;nbsp;&amp;nbsp;\VB&lt;br /&gt;&amp;nbsp;&amp;nbsp;\CS&lt;br /&gt;&lt;br /&gt;This still will not correctly compile these class files into separate assemblies, at least not until you make some additions to the web.config file. &lt;br /&gt;&lt;br /&gt;In the web.config file , change the &amp;LT;compilation&amp;GT;&lt;br /&gt;node so that it is structured as following: &lt;br /&gt;&lt;br /&gt;&amp;LT;compilation&amp;GT;&lt;br /&gt;&amp;LT;codeSubDirectories&amp;GT;&lt;br /&gt;&amp;LT;add directoryName="VB"&amp;GT;&amp;LT;/add&amp;GT;&lt;br /&gt;&amp;LT;add directoryName="CS"&amp;GT;&amp;LT;/add&amp;GT;&lt;br /&gt;&amp;LT;/codeSubDirectories&amp;GT;&lt;br /&gt;&amp;LT;/compilation&amp;GT;&lt;br /&gt;&lt;br /&gt;Now that this is in place in your web.config file, you can work with each of the classes in your ASP.NET pages. In addition, any C# class placed in the CS folder is now automatically compiled just like any of the classes placed in the VB folder. &lt;br /&gt;&lt;br /&gt;NOTE: The name of sub directories are'VB' and 'CS' for this example. You can put any name you wish to.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-9204030845067118579?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/9204030845067118579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=9204030845067118579' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/9204030845067118579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/9204030845067118579'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/11/how-to-place-two-classes-written-in.html' title='How to place two classes written in different languages in App_Code'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-3250941110052824091</id><published>2009-11-10T08:32:00.000-08:00</published><updated>2009-11-10T08:41:43.607-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SharePoint Server 2010'/><title type='text'>SharePoint Server 2010 Preliminary System Requirements</title><content type='html'>&lt;p&gt;Sharepoint Server 2010 is on its way and it is high time to get ourself familiar with the system requirement of SharePoint Server 2010..&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;SharePoint Server 2010 will be 64 bit only.&lt;/li&gt;&lt;li&gt;SharePoint Server 2010 requires 64 bit Windows Server 2008 (R2)&lt;/li&gt;&lt;li&gt;SharePoint Server 2010 requires 64 bit SQL Server 2005 or 2008&lt;/li&gt;&lt;li&gt;SharePoint Server 2010 will support only IE7, IE8 and Firefox 3.x on Windows OS.&lt;/li&gt;&lt;li&gt;IE6 will not be supported by SharePoint Server 2010&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The reason SharePoint platform is upgrading to 64 bit is to utilize the full power of extra bits while using 64 bit bus. &lt;/p&gt;&lt;p&gt;SharePoint performance and scalability can benefit significantly from 64-bit SQL Server and the throughput increases are significant enough for us to make the difficult decision to only support SharePoint Server 2010 on 64-bit SQL Server 2005 or 2008. It has been our strong recommendation for some time that SharePoint Server 2007 customers take advantage of 64-bit SQL Server due to the inherent performance and scale benefits it can provide. &lt;/p&gt;&lt;p&gt;Look out for the space for more news on SharePoint Server 2010.....&lt;/p&gt;&lt;p&gt;Varun&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-3250941110052824091?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/3250941110052824091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=3250941110052824091' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/3250941110052824091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/3250941110052824091'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/11/sharepoint-server-2010-preliminary.html' title='SharePoint Server 2010 Preliminary System Requirements'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-1061592486298034243</id><published>2009-09-08T22:13:00.000-07:00</published><updated>2009-09-08T22:16:55.447-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VBScript'/><title type='text'>How to disconnect a map drive using vbscript</title><content type='html'>In my previous post, I described how to connect to a network drive.&lt;br /&gt;In this post, I will demonstrate how to disconnect from an existing connected network drive.&lt;br /&gt;&lt;br /&gt;Suppose we have a drive Z: that is a network drive connected. Following is the code regarding how ti remove it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;Option Explicit&lt;br /&gt;Dim WshNetwork, ShareName&lt;br /&gt;Set WshNetwork = WScript.CreateObject("WScript.Network")&lt;br /&gt;ShareName = "Z:"&lt;br /&gt;WshNetwork.RemoveNetworkDrive ShareName, true, true&lt;br /&gt;WScript.Quit&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;We are creating an object of WScript.Network and calling method RemoveNetworkDrive by passing the drive letter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-1061592486298034243?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/1061592486298034243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=1061592486298034243' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1061592486298034243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1061592486298034243'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/09/how-to-disconnect-map-drive-using.html' title='How to disconnect a map drive using vbscript'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-8398878234860550818</id><published>2009-09-08T22:04:00.000-07:00</published><updated>2009-09-08T22:12:43.893-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VBScript'/><title type='text'>How to map network drive using VBScript</title><content type='html'>Some time it is required to map a network drive using vbscript. &lt;br /&gt;Today I will demonstate how to connet and then disconnect from a network drive.&lt;br /&gt;&lt;br /&gt;In order to connect to a network drive, we need following data/information:&lt;br /&gt;&lt;br /&gt;1. HomeServer Location: Actual path of the drive. In our example it is &lt;br /&gt;   "\\125.99.218.158\Data"&lt;br /&gt;&lt;br /&gt;2. Name of the drive you wish to give: Let us say Z:&lt;br /&gt;&lt;br /&gt;3. UserId/Password using which we will connect the map drive. If userid is same as logged in user then it is not required.&lt;br /&gt;&lt;br /&gt;We will create an object of WScript.Network and call its method MapNetworkDrive&lt;br /&gt;&lt;br /&gt;Here is the code:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Option Explicit&lt;br /&gt;Dim strUser, strPassword, strDriveLetter, strHomeServer, strProfile&lt;br /&gt;Dim objNetwork&lt;br /&gt;Set objNetwork = CreateObject("WScript.Network")&lt;br /&gt;&lt;br /&gt;strDriveLetter = "Z:" &lt;br /&gt;strHomeServer = "\\125.99.218.158\Data"&lt;br /&gt;strProfile = "False"   ' Mapping (not) stored in user Profile&lt;br /&gt;strUser = "USERID"&lt;br /&gt;strPassword = "PASSWORD"&lt;br /&gt;&lt;br /&gt;objNetwork.MapNetworkDrive strDriveLetter,strHomeServer,strProfile,strUser,strPassword &lt;br /&gt;&lt;br /&gt;WScript.Quit&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;So the above code is creating an object of Wscript.Network and calling method MapNetworkDrive by passwing parameters like drive letter, hom server, userid and password. &lt;br /&gt;There is one more parameter that is strProfile. If set true, it will store the drive info in user profile and it will connect automatically next time when user logs in.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-8398878234860550818?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/8398878234860550818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=8398878234860550818' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8398878234860550818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8398878234860550818'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/09/how-to-map-network-drive-using-vbscript.html' title='How to map network drive using VBScript'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-1551838044426944550</id><published>2009-07-29T08:50:00.001-07:00</published><updated>2009-09-08T22:14:49.198-07:00</updated><title type='text'></title><content type='html'>&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-1551838044426944550?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/1551838044426944550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=1551838044426944550' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1551838044426944550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1551838044426944550'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/07/blog-post.html' title=''/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-6220067229599869230</id><published>2009-07-21T05:42:00.000-07:00</published><updated>2009-07-21T05:56:12.032-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VBScript'/><title type='text'>How to send mail using CDO in VBScript</title><content type='html'>Today we will see how to send mail using CDO in VBScript. The same code can be used in ASP, VB also with small modification.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;STEP 1: Define the constants:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Const cdoSendUsingMethod="http://schemas.microsoft.com/cdo/configuration/sendusing"&lt;br /&gt;Const cdoSendUsingPort  = 2&lt;br /&gt;Const cdoSMTPServer     ="http://schemas.microsoft.com/cdo/configuration/smtpserver"&lt;br /&gt;Const cdoSMTPServerPort ="http://schemas.microsoft.com/cdo/configuration/smtpserverport"&lt;br /&gt;Const cdoSMTPConnectionTimeout  ="http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"&lt;br /&gt;Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"&lt;br /&gt;Const cdoBasic = 1&lt;br /&gt;Const cdoSendUserName="http://schemas.microsoft.com/cdo/configuration/sendusername"&lt;br /&gt;Const cdoSendPassword ="http://schemas.microsoft.com/cdo/configuration/sendpassword"&lt;br /&gt;Const CdoReferenceTypeName = 1&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;STEP 2: Declare variables&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Dim objConfig  ' As CDO.Configuration&lt;br /&gt;Dim objMessage ' As CDO.Message&lt;br /&gt;Dim Fields     ' As ADODB.Fields&lt;br /&gt;Dim HtmlBody&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;STEP 3: Get a handle on the config object and it's fields&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;' Get a handle on the config object and it's fields&lt;br /&gt;Set objConfig = CreateObject("CDO.Configuration")&lt;br /&gt;Set Fields = objConfig.Fields&lt;br /&gt;&lt;br /&gt;' Set config fields we care about&lt;br /&gt;With Fields&lt;br /&gt; .Item(cdoSendUsingMethod)       = cdoSendUsingPort&lt;br /&gt; .Item(cdoSMTPServer)            = &amp;LT;SMTP-SERVER-NAME&amp;GT;&lt;br /&gt; .Item(cdoSMTPServerPort)        = &amp;LT;PORT-NUMBER&amp;GT;&lt;br /&gt; .Item(cdoSMTPConnectionTimeout) = 10&lt;br /&gt; .Item(cdoSMTPAuthenticate)      = cdoBasic&lt;br /&gt; .Item(cdoSendUsingMethod ) = 2&lt;br /&gt; .Update&lt;br /&gt;End With&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;STEP 4: Create instance CDO.Messsage object&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Set objMessage = CreateObject("CDO.Message")&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;STEP 5: Add image to the mail body&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Add this step only if you have an image to add to the body&lt;br /&gt;Set objBP = objMessage.AddRelatedBodyPart("C:\Users\Varun.Sharma\Shell\1.jpg", "1.jpg", CdoReferenceTypeName)&lt;br /&gt;objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "&amp;LT;1.jpg&amp;GT;"&lt;br /&gt;objBP.Fields.Update&lt;br /&gt;&lt;br /&gt;For description of step 5, visit: &lt;a href="http://firstblogofvarun.blogspot.com/2009/07/how-to-add-image-to-mail-body-using-cdo.html"&gt;How to add image to mail body using CDO &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;STEP 6: assign the properties of CDO.Message object&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Set objMessage.Configuration = objConfig&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;STEP 7: Build the HTML Body&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Always prepare your html body before hand. That will help your code look better&lt;br /&gt;&lt;br /&gt;HtmlBody="&amp;LT;img src=1.jpg&amp;GT;&amp;LT;br&amp;GT;" &lt;br /&gt;HtmlBody=HtmlBody &amp; " Sending mail using CDO"&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;STEP 8:  Set the CDO.Message mail properties&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;With objMessage&lt;br /&gt; .To       = To-Address&lt;br /&gt; .Cc   = CC-Address  &lt;br /&gt; .From     = From-Address&lt;br /&gt; .Subject  = "SMTP Relay Test"&lt;br /&gt; .HtmlBody=HtmlBody &lt;br /&gt; .Send&lt;br /&gt;End With&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;STEP 9: Release the CDO instances&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Set Fields = Nothing&lt;br /&gt;Set objMessage = Nothing&lt;br /&gt;Set objConfig = Nothing&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;FULL CODE:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Const cdoSendUsingMethod  ="http://schemas.microsoft.com/cdo/configuration/sendusing"&lt;br /&gt;Const cdoSendUsingPort    = 2&lt;br /&gt;Const cdoSMTPServer       ="http://schemas.microsoft.com/cdo/configuration/smtpserver"&lt;br /&gt;Const cdoSMTPServerPort   ="http://schemas.microsoft.com/cdo/configuration/smtpserverport"&lt;br /&gt;Const cdoSMTPConnectionTimeout  ="http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"&lt;br /&gt;Const cdoSMTPAuthenticate       ="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"&lt;br /&gt;Const cdoBasic                  = 1&lt;br /&gt;Const cdoSendUserName           ="http://schemas.microsoft.com/cdo/configuration/sendusername"&lt;br /&gt;Const cdoSendPassword           ="http://schemas.microsoft.com/cdo/configuration/sendpassword"&lt;br /&gt;Const CdoReferenceTypeName = 1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Dim objConfig  ' As CDO.Configuration&lt;br /&gt;Dim objMessage ' As CDO.Message&lt;br /&gt;Dim Fields     ' As ADODB.Fields&lt;br /&gt;Dim HtmlBody&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;' Get a handle on the config object and it's fields&lt;br /&gt;Set objConfig = CreateObject("CDO.Configuration")&lt;br /&gt;Set Fields = objConfig.Fields&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;' Set config fields we care about&lt;br /&gt;With Fields&lt;br /&gt; .Item(cdoSendUsingMethod)       = cdoSendUsingPort&lt;br /&gt; .Item(cdoSMTPServer)            = SMTP-SERVER-NAME&lt;br /&gt; .Item(cdoSMTPServerPort)        = PORT-NUMBER&lt;br /&gt; .Item(cdoSMTPConnectionTimeout) = 10&lt;br /&gt; .Item(cdoSMTPAuthenticate)      = cdoBasic&lt;br /&gt; .Item(cdoSendUsingMethod ) = 2&lt;br /&gt; .Update&lt;br /&gt;End With&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Set objMessage = CreateObject("CDO.Message")&lt;br /&gt;&lt;br /&gt;Set objBP = objMessage.AddRelatedBodyPart(PHYSICAL-PATH-OF-IMAGE, "1.jpg", CdoReferenceTypeName)&lt;br /&gt;objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "&amp;LT;1.jpg&amp;GT;"&lt;br /&gt;objBP.Fields.Update&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Set objMessage.Configuration = objConfig&lt;br /&gt;HtmlBody="&amp;LT;img src=1.jpg&amp;GT;&amp;LT;br&amp;GT;"&lt;br /&gt;HtmlBody=HtmlBody &amp; "Testing the mail"&lt;br /&gt;&lt;br /&gt;With objMessage&lt;br /&gt; .To       = TO-ADDRESS&lt;br /&gt; .Cc   = CC-ADDRESS&lt;br /&gt; .From     = FROM-ADDRESS&lt;br /&gt; .Subject  = "SMTP Relay Test"&lt;br /&gt; '.TextBody = "SMTP Relay Test Sent @ " &amp; Now()&lt;br /&gt; .HtmlBody=HtmlBody &lt;br /&gt; .Send&lt;br /&gt;End With&lt;br /&gt;&lt;br /&gt;Set Fields = Nothing&lt;br /&gt;Set objMessage = Nothing&lt;br /&gt;Set objConfig = Nothing&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-6220067229599869230?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/6220067229599869230/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=6220067229599869230' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6220067229599869230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6220067229599869230'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/07/how-to-send-mail-using-cdo-in-vbscript.html' title='How to send mail using CDO in VBScript'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-1213971972627996128</id><published>2009-07-21T05:35:00.000-07:00</published><updated>2009-07-21T05:57:28.231-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VBScript'/><title type='text'>How to add image to mail body using CDO</title><content type='html'>Many times we face situation like, we need to send image in the html body of the mail that too using CDO.&lt;br /&gt;&lt;br /&gt;Suppose we have an image at local server from where MailSend Code will get fire, here is the code:&lt;br /&gt;&lt;br /&gt;Add this line of code to your CDO code to send image as a mail body:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Set objMessage = CreateObject("CDO.Message")&lt;br /&gt;Set objBP = objMessage.AddRelatedBodyPart("C:\Users\Varun.Sharma\Shell\1.jpg", "1.jpg", CdoReferenceTypeName)&lt;br /&gt;objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "&amp;LT;1.jpg&amp;GT;"&lt;br /&gt;objBP.Fields.Update&lt;br /&gt;&lt;br /&gt;Here, in AddRelatedBodyPart, &lt;br /&gt;argument 1 is : physical location of image&lt;br /&gt;argument 2 is : identifier of the image (any name)&lt;br /&gt;argument 3 is : To tell CDO to send the image as well&lt;br /&gt;&lt;br /&gt;In next line, just put image identifer to the right hand side.&lt;br /&gt;&lt;br /&gt;When sending mail refer the image in html body like this:&lt;br /&gt;&lt;br /&gt;mail.HtmlBody="&amp;LT;img src=1.jpg" &amp;GT;&lt;br /&gt;&lt;br /&gt;For full code of sending mail using CDO, check the following link:&lt;br /&gt;&lt;a href="http://firstblogofvarun.blogspot.com/2009/07/how-to-send-mail-using-cdo-in-vbscript.html"&gt;How to send mail using cdo in vbscript&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-1213971972627996128?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/1213971972627996128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=1213971972627996128' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1213971972627996128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1213971972627996128'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/07/how-to-add-image-to-mail-body-using-cdo.html' title='How to add image to mail body using CDO'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-2580501542778546062</id><published>2009-07-05T22:21:00.000-07:00</published><updated>2009-07-05T22:41:37.331-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UML'/><title type='text'>Learning UML with C#</title><content type='html'>UML is a simple diagramming style that was developed from work done by Grady Booch, James Rumbaugh, and Ivar Jacobson, which resulted in a merging of ideas into a single specification and, eventually, a standard.&lt;br /&gt;&lt;br /&gt;Here , We will see how to map a class and its relation in UML.&lt;br /&gt;&lt;br /&gt;Basic UML diagrams consist of boxes representing classes. Let’s consider&lt;br /&gt;the following class (which has very little actual function).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Basic Class :&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;public class Person {&lt;br /&gt;private string name;&lt;br /&gt;private int age;&lt;br /&gt;//-----&lt;br /&gt;public Person(string nm, int ag) {&lt;br /&gt;name = nm;&lt;br /&gt;age = ag;&lt;br /&gt;}&lt;br /&gt;public string makeJob() {&lt;br /&gt;return "hired";&lt;br /&gt;}&lt;br /&gt;public int getAge() {&lt;br /&gt;return age;&lt;br /&gt;}&lt;br /&gt;public void splitNames() {&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;We can represent this class in UML, as shown in Figure &lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_AififblDFCg/SlGKUMhypwI/AAAAAAAABmg/ZLEZ7MLFINI/s1600-h/uml1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 230px; height: 137px;" src="http://2.bp.blogspot.com/_AififblDFCg/SlGKUMhypwI/AAAAAAAABmg/ZLEZ7MLFINI/s400/uml1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5355213511485204226" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The top part of the box contains the class name and package name (if any).&lt;br /&gt;The second compartment lists the class’s variables, and the bottom compartment lists its methods. The symbols in front of the names indicate that member's visibility, where "+" means public, "-" means private, and "#" means protected. Static methods are shown underlined. &lt;br /&gt;&lt;br /&gt;Abstract methods may be shown in italics or in an “{abstract}” label.&lt;br /&gt;&lt;br /&gt;UML does not require that you show all of the attributes of a class, and it&lt;br /&gt;is usual only to show the ones of interest to the discussion at hand.&lt;br /&gt;&lt;br /&gt;&lt;hr/&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Inheritance:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now, we will look into inheritance and how to implement it in UML.&lt;br /&gt;&lt;br /&gt;Let’s consider a version of Person that has public, protected, and private variables and methods, and an Emplo yee class derived from it.&lt;br /&gt;&lt;br /&gt;public abstract class Person {&lt;br /&gt;protected string name;&lt;br /&gt;private int age;&lt;br /&gt;//-----&lt;br /&gt;public Person(string nm, int ag) {&lt;br /&gt;name = nm;&lt;br /&gt;age = ag;&lt;br /&gt;}&lt;br /&gt;public string makeJob() {&lt;br /&gt;return "hired";&lt;br /&gt;}&lt;br /&gt;public int getAge() {&lt;br /&gt;return age;&lt;br /&gt;}&lt;br /&gt;public void splitNames() {&lt;br /&gt;}&lt;br /&gt;public abstract string getJob(); //must override&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;We now derive the Employee class from it, and fill in some code for the getJob method.&lt;br /&gt;&lt;br /&gt;public class Employee : Person {&lt;br /&gt;public Employee(string nm, int ag):base(nm, ag){&lt;br /&gt;}&lt;br /&gt;public override string getJob() {&lt;br /&gt;return "Worker";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;You represent inheritance using a solid line and a hollow triangular arrow.&lt;br /&gt;For the simple Employee class that is a subclass of Person, we represent this in UML, as shown in Figure&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_AififblDFCg/SlGLoIN0bCI/AAAAAAAABmo/g730XVYV89o/s1600-h/uml2.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 143px;" src="http://4.bp.blogspot.com/_AififblDFCg/SlGLoIN0bCI/AAAAAAAABmo/g730XVYV89o/s400/uml2.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5355214953436703778" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Note that the name of the Employee class is not in italics because it is now a concrete class and because it includes a concrete method for the formerly abstract getJob method.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-2580501542778546062?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/2580501542778546062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=2580501542778546062' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2580501542778546062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2580501542778546062'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/07/learning-uml-witn-c.html' title='Learning UML with C#'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_AififblDFCg/SlGKUMhypwI/AAAAAAAABmg/ZLEZ7MLFINI/s72-c/uml1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-8879288618842908864</id><published>2009-06-19T01:56:00.000-07:00</published><updated>2009-06-27T09:15:40.902-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OOPS'/><title type='text'>OOPS Part II -- Pillars of OOPS -- Inheritance, Polymorphism, Encapsulation</title><content type='html'>Part I --&gt; &lt;A href="http://firstblogofvarun.blogspot.com/2009/06/oops-part-i-understanding-object.html"&gt;OOPS Part I -- OOPS Part I -- Understanding the Object Oriented Programming &lt;/a&gt;&lt;br /&gt;&lt;/hr&gt;&lt;br /&gt;All object-based languages must contend with three core principals of object-oriented programming, often called the "pillars of object-oriented programming (OOP)":&lt;br /&gt;&lt;br /&gt;• &lt;strong&gt;Encapsulation&lt;/strong&gt;: How does this language hide an object’s internal implementation details and preserve data integrity?&lt;br /&gt;• &lt;strong&gt;Inheritance&lt;/strong&gt;: How does this language promote code reuse?&lt;br /&gt;• &lt;strong&gt;Polymorphism&lt;/strong&gt;: How does this language let you treat related objects in a similar way?&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;The Role of Encapsulation&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;The first pillar of OOP is called encapsulation. This trait boils down to the language’s ability to hide unnecessary implementation details from the object user.&lt;br /&gt;&lt;br /&gt;For example, assume you are using a class named DatabaseReader, which has two primary methods: Open() and Close():&lt;br /&gt;&lt;br /&gt;// This type encapsulates the details of opening and closing a database.&lt;br /&gt;DatabaseReader dbReader = new DatabaseReader();&lt;br /&gt;dbReader.Open(@"C:\MyCars.mdf");&lt;br /&gt;// Do something with data file and close the file.&lt;br /&gt;dbReader.Close();&lt;br /&gt;&lt;br /&gt;The fictitious DatabaseReader class encapsulates the inner details of locating, loading, manipulating, and closing the data file. Object users love encapsulation, as this pillar of OOP keeps programming tasks simpler. There is no need to worry about the numerous lines of code that are working behind the scenes to carry out the work of the DatabaseReader class. All you do is create an instance and send the appropriate messages &lt;br /&gt;&lt;br /&gt;Closely related to the notion of encapsulating programming logic is the idea of data hiding. Ideally, an object’s state data should be specified using the private (or possibly protected) keyword. In this way, the outside world must ask politely in order to change or obtain the underlying value. This is a good thing, as publicly declared data points can easily become corrupted (hopefully by accident rather than intent!). You will formally examine this aspect of encapsulation in just a bit.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;The Role of Inheritance&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;The next pillar of OOP, &lt;strong&gt;inheritance&lt;/strong&gt;, boils down to the language’s ability to allow you to build new class definitions based on existing class definitions. &lt;br /&gt;&lt;br /&gt;In essence, inheritance allows you to extend the behavior of a base (or parent) class by inheriting core functionality into the derived subclass (also called a child class).&lt;br /&gt;&lt;br /&gt;Figure below shows a simple example. You can read the diagram in Figure as "A Hexagon is-a Shape that is-an Object." &lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_AififblDFCg/SjtXlL-gkfI/AAAAAAAABDQ/TZRYbTNMzhw/s1600-h/1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 351px; height: 269px;" src="http://2.bp.blogspot.com/_AififblDFCg/SjtXlL-gkfI/AAAAAAAABDQ/TZRYbTNMzhw/s400/1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5348965278814343666" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When you have classes related by this form of inheritance, you establish "is-a" relationships between types. &lt;strong&gt;The "is-a" relationship is termed classical inheritance.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Here, you can assume that Shape defines some number of members that are common to all&lt;br /&gt;descendents. Given that the Hexagon class extends Shape, it inherits the core functionality defined by Shape and Object, as well as defines additional hexagon-related details of its own (whatever those may be).&lt;br /&gt;&lt;br /&gt;There is another form of code reuse in the world of OOP: the containment/delegation model&lt;br /&gt;(also known as the “has-a” relationship or aggregation). This form of reuse is not used to establish parent/child relationships. Rather, the “has-a” relationship allows one class to define a member variable of another class and expose its functionality (if required) to the object user indirectly.&lt;br /&gt;&lt;br /&gt;For example, assume you are again modeling an automobile. You might want to express the&lt;br /&gt;idea that a car “has-a” radio. It would be illogical to attempt to derive the Car class from a Radio, or vice versa (a Car “is-a” Radio? I think not!). Rather, you have two independent classes working together, where the Car class creates and exposes the Radio’s functionality:&lt;br /&gt;&lt;br /&gt;class Radio&lt;br /&gt;{&lt;br /&gt;public void Power(bool turnOn)&lt;br /&gt;{&lt;br /&gt;Console.WriteLine("Radio on: {0}", turnOn);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;class Car&lt;br /&gt;{&lt;br /&gt;// Car 'has-a' Radio&lt;br /&gt;private Radio myRadio = new Radio();&lt;br /&gt;public void TurnOnRadio(bool onOff)&lt;br /&gt;{&lt;br /&gt;// Delegate call to inner object.&lt;br /&gt;myRadio.Power(onOff);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Notice that the object user has no clue that the Car class is making use of an inner Radio object.&lt;br /&gt;static void Main(string[] args)&lt;br /&gt;{&lt;br /&gt;// Call is forwarded to Radio internally.&lt;br /&gt;Car viper = new Car();&lt;br /&gt;viper.TurnOnRadio(false);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Difference Between Inherating a class and instantiating a class &lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;When you inherit a class, you get the superclass attributes and methods that you can use without instantiating a superclass object. You can only use those which are public or protected.&lt;br /&gt;If you instantiate them, you make an object and upon that object you call methods defined in the object's class.&lt;br /&gt;&lt;br /&gt;When you inherit a class, base class from which a class is derived does not have state, behaviour or identity where as if you create an instance of a class, the base class sets it's identity, state, behaviour.&lt;br /&gt;&lt;br /&gt;When you create an instance of an object, you can access the method of the class by using dot operator (.) but if you inherit a class, you can not access base class method by using dot operator.&lt;br /&gt;&lt;br /&gt;Use Inheritance when you are sure that you need to extend few methods of the base class or need to add some more methods to it otherwise just create the instance of the class. &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;The Role of Polymorphism&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;The final pillar of OOP is polymorphism. This trait captures a language’s ability to treat related objects in a similar manner. Specifically, this tenant of an object-oriented language allows a base class to define a set of members (formally termed the polymorphic interface) that are available to all descendents. A class’s polymorphic interface is constructed using any number of virtual or abstract members.&lt;br /&gt; &lt;br /&gt;In a nutshell, a virtual member is a member in a base class that defines a default implementation that may be changed (or more formally speaking, overridden) by a derived class. In contrast, an abstract method is a member in a base class that does not provide a default implementation, but does provide a signature. When a class derives from a base class defining an abstract method, it must be overridden by a derived type. In either case, when derived types override the members defined by a base class, they are essentially redefining how they respond to the same request.&lt;br /&gt;&lt;br /&gt;To preview polymorphism, let’s provide some details behind the shapes hierarchy shown in&lt;br /&gt;Figure. Assume that the Shape class has defined a virtual method named Draw() that takes no parameters. Given the fact that every shape needs to render itself in a unique manner, subclasses (such as Hexagon and Circle) are free to override this method to their own liking.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_AififblDFCg/SjteBY1IfYI/AAAAAAAABDY/EaAEA0bfCDQ/s1600-h/2.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 201px;" src="http://3.bp.blogspot.com/_AififblDFCg/SjteBY1IfYI/AAAAAAAABDY/EaAEA0bfCDQ/s400/2.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5348972360370781570" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Once a polymorphic interface has been designed, you can begin to make various assumptions&lt;br /&gt;in your code. For example, given that Hexagon and Circle derive from a common parent (Shape), an array of Shape types could contain anything deriving from this base class. Furthermore, given that Shape defines a polymorphic interface to all derived types (the Draw() method in this example), we can assume each member in the array has this functionality. Consider the following Main() method, which instructs an array of Shape-derived types to render themselves using the Draw() method:&lt;br /&gt;&lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;static void Main(string[] args)&lt;br /&gt;{&lt;br /&gt;Shape[] myShapes = new Shape[3];&lt;br /&gt;myShapes[0] = new Hexagon();&lt;br /&gt;myShapes[1] = new Circle();&lt;br /&gt;myShapes[2] = new Hexagon();&lt;br /&gt;foreach (Shape s in myShapes)&lt;br /&gt;{&lt;br /&gt;s.Draw();&lt;br /&gt;}Console.ReadLine();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This wraps up our brisk overview of the pillars of OOP. Now that you have the theory in your mind, the remainder of this chapter explores further details of how encapsulation is handled under C#. The next chapter will tackle the details of inheritance and polymorphism.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-8879288618842908864?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/8879288618842908864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=8879288618842908864' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8879288618842908864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8879288618842908864'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/06/oops-part-ii-pillars-of-oops.html' title='OOPS Part II -- Pillars of OOPS -- Inheritance, Polymorphism, Encapsulation'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_AififblDFCg/SjtXlL-gkfI/AAAAAAAABDQ/TZRYbTNMzhw/s72-c/1.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-5477571628618501240</id><published>2009-06-18T22:57:00.000-07:00</published><updated>2009-06-27T09:15:57.438-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OOPS'/><title type='text'>OOPS Part I -- Understanding the Object Oriented Programming</title><content type='html'>This chapter is a basic introduction to object-oriented programming. It introduces you to some of the basic concepts and terms you need to know as you get a handle on the specific details of how object-oriented programming works.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;What Is Object-Oriented Programming?&lt;/h3&gt;The term object-oriented programming means many different things. But at its heart, object-oriented programming is a type of computer programming based on the premise that all programs are essentially computer-based simulations of real-world objects or abstract concepts.&lt;br /&gt;&lt;br /&gt;For example: Flight-simulator programs attempt to mimic the behavior of real airplanes. Some do an amazingly good job; military and commercial pilots train on them.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Understanding Objects&lt;/h3&gt;Objects-both in the real world and in the world of programming-are entities that have certain basic characteristics. The following sections describe some of the more important of these characteristics:&lt;strong&gt; identity, type, state, and behavior&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Objects have identity &lt;/h4&gt;Every object in an object-oriented program has an identity. In other words, every occurrence of a particular type of object-called an instance-can be distinguished from every other occurrence of the same type of object, as well as from objects of other types.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Objects have type&lt;/h4&gt;Object-oriented programming lets you assign names to the different kind of objects in a program. Types are defined by classes. So when you create an object from a type, you're saying that the object is of the type specified by the class. For example, the following statement creates an object of type Invoice:&lt;br /&gt;&lt;br /&gt;Invoice i = new Invoice();&lt;br /&gt;&lt;br /&gt;In this case, the identity of this object (that is, its address in memory) is assigned to the variable i, which the compiler knows can hold references to objects of type Invoice.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Objects have state&lt;/h4&gt;&lt;p&gt;The type of an object determines what attributes the object has. Thus, all objects of a particular type have the same attributes. However, they don't necessarily have the same values for those attributes.&lt;br /&gt;The combination of the values for all the attributes of an object is called the object's state. Unlike its identity, an object's state can and usually does change over its lifetime.&lt;br /&gt;&lt;br /&gt;Here are a few more interesting details about object state:&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Some of the attributes of an object are publicly known, but others can be private. The private attributes may be vital to the internal operation of the object, but no one outside of the object knows they exist. They're like your private thoughts: They affect what you say and do, but nobody knows them but you. &lt;/li&gt;&lt;li&gt;The state of an object is represented by class variables, which are called fields. A public field is a field that's declared with the public keyword so the variable can be visible to the outside world.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Objects have behaviour&lt;/h4&gt;&lt;p&gt;&lt;br /&gt;Another characteristic of objects is that they have behavior, which means they can do things. Like state, the specific behavior of an object depends on its type. But unlike state, the behavior isn't different for each instance of a type.&lt;br /&gt;&lt;br /&gt;Another way to say that objects have behavior is to say they provide services that can be used by other objects. The behavior of an object is provided by its methods.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/hr&gt;&lt;br /&gt;&lt;strong&gt;&lt;A href="http://firstblogofvarun.blogspot.com/2009/06/oops-part-ii-pillars-of-oops.html"&gt;OOPS Part II -- Pillars of OOPS -- Inheritance, Polymorphism, Encapsulation&lt;/a&gt; &lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-5477571628618501240?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/5477571628618501240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=5477571628618501240' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/5477571628618501240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/5477571628618501240'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/06/oops-part-i-understanding-object.html' title='OOPS Part I -- Understanding the Object Oriented Programming'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-3487457768192443360</id><published>2009-06-18T22:09:00.000-07:00</published><updated>2009-06-27T09:16:14.013-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Interview Experience'/><title type='text'>Interview Experience with PWC</title><content type='html'>Recently I gave an interview with PWC.. Though not selected, I would like to share my experience with you all. Here are the list of questions asked in Round I:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;01. Tell me about your education background, work profile.&lt;br /&gt;02. Is dot net object oriented?&lt;br /&gt;Here I said 'YES'..so next question&lt;br /&gt; &lt;br /&gt;Lets start with OOPS&lt;br /&gt;------OOPS------------&lt;br /&gt;03. What is an abstract class?&lt;br /&gt;04. What is an interface?&lt;br /&gt;05. What is the difference between abstract class and an interface?&lt;br /&gt;06. When to use what (abstract/interface)?&lt;br /&gt;07. Give practical scenario regarding usage.&lt;br /&gt;08. What is the relation between virtual and override keyword?&lt;br /&gt;09. What is Polymorphism?&lt;br /&gt;10. What is method overloading and method overriding?&lt;br /&gt;11. What is singleton class?&lt;br /&gt;12. When to use singleton class?&lt;br /&gt;13. Any class in dot net framework that is an example of singleton class?&lt;br /&gt;14. What is inheritance?&lt;br /&gt;-------------------------&lt;br /&gt; &lt;br /&gt;------SHAREPOINT-------------&lt;br /&gt;You have worked on SharePoint also....YES&lt;br /&gt;SharePoint coding or just Out-Of-Box? ... Coding&lt;br /&gt; &lt;br /&gt;15. What is a web part?&lt;br /&gt;16. Advantage of web part?&lt;br /&gt;17. How to deploy a web part..step by step&lt;br /&gt;18. What is the command line utility used in SharePoint?&lt;br /&gt;19. How you can implement List Item listener?&lt;br /&gt;20. Scenario: You need to check before inserting an item to list that whether the EmpID( field) is unique or not? How will you implement?&lt;br /&gt;21. How will you deploy a feature?&lt;br /&gt;-------------------------&lt;br /&gt; &lt;br /&gt;-------Database-----------&lt;br /&gt;22. What is an index?&lt;br /&gt;23. How many types of index are there?&lt;br /&gt;24. How many index I can have on a table? Any max limit?&lt;br /&gt;25. What is difference between a primary key and unique key?&lt;br /&gt;26. What are constraints?&lt;br /&gt;27. Name any constraint?&lt;br /&gt;28. Scenario: Table: EMPID, EMPDEPT, SALARY. You need to restrict that one can insert a row where salary is less than 5000. How will you implement that?&lt;br /&gt;29. What is trigger and of how many types?&lt;br /&gt;30. Have you worked on cursors?..I said no..that's why no further questions&lt;br /&gt;---------------------------&lt;br /&gt; &lt;br /&gt;--------DOT NET-----------&lt;br /&gt;31. What are attributes in dot net?&lt;br /&gt;32. Can we define user defined attributes?..IF yes then How?&lt;br /&gt;33. How web service communicates between two non-compatible platforms?&lt;br /&gt;34. Can web service preserve state? How?&lt;br /&gt;35. What is singleton web service?&lt;br /&gt;36. When we add a class file, what remains the default assess modifier?&lt;br /&gt;37. Difference between protected internal, protected ?&lt;br /&gt;38. What is MVC?&lt;br /&gt;39. How will you relate MVC with 3-tier architecture?&lt;br /&gt;--------------------------&lt;br /&gt; &lt;br /&gt;-------Process Oriented----------&lt;br /&gt;40. Can you name and explain any design pattern with example&lt;br /&gt;41. Have you ever used any defect analysis?&lt;br /&gt;42. What type of proceed flow you use?&lt;br /&gt;43. Have you ever designed design document?&lt;br /&gt;44. What are the main parts of a design document?&lt;br /&gt;45. What tool you used in order to draw class diagrams?&lt;br /&gt;46. Any idea regarding UML?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-3487457768192443360?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/3487457768192443360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=3487457768192443360' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/3487457768192443360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/3487457768192443360'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/06/interview-experience-with-pwc.html' title='Interview Experience with PWC'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-7323446465958950731</id><published>2009-06-14T22:10:00.000-07:00</published><updated>2009-06-27T09:17:09.106-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Structure of Sharepoint Site and Navigation</title><content type='html'>SharePoint sites are always part of a &lt;strong&gt;site collection&lt;/strong&gt;, which has a single parent or top - level site . &lt;br /&gt;&lt;br /&gt;The top - level site can have any number of child sites, grandchildren, and so on, and each site will have one or more pages in a page library . &lt;br /&gt;&lt;br /&gt;The site structure is therefore based on pages(the leaf nodes, which are viewable by end users) and sites (the containers, each of which has at least one default page to display).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_AififblDFCg/SjXmKZil4pI/AAAAAAAABDI/i6t9UJEAqro/s1600-h/1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 325px;" src="http://2.bp.blogspot.com/_AififblDFCg/SjXmKZil4pI/AAAAAAAABDI/i6t9UJEAqro/s400/1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5347433198901387922" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-7323446465958950731?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/7323446465958950731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=7323446465958950731' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7323446465958950731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7323446465958950731'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/06/structure-of-sharepoint-site-and.html' title='Structure of Sharepoint Site and Navigation'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_AififblDFCg/SjXmKZil4pI/AAAAAAAABDI/i6t9UJEAqro/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-2142215274185380462</id><published>2009-06-11T20:59:00.000-07:00</published><updated>2009-06-27T09:18:44.998-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>How to get Data from Active Directory using C#</title><content type='html'>Today, I am going to discuss how to fetch data from active directory and how to store it into a clas..&lt;br /&gt;&lt;br /&gt;We can access LDAP or AD by using two class: DirectoryEntry and DirectorySearcher&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;Add reference to &lt;strong&gt;System.DirectoryServices&lt;/strong&gt; amd import it in the code by entering &lt;strong&gt;using System.DirectoryServices;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 2: &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;We need the AD Location, AD Userid and AD Password in order to read data from it. &lt;br /&gt;&lt;br /&gt;We store these values in web.config: &lt;br /&gt;&lt;strong&gt;&amp;LT;appSettings&amp;GT;&lt;br /&gt; &amp;LT;add key="GaadLocation" value="LDAP://XXXXX:XXX"/&amp;GT;&lt;br /&gt; &amp;LT;add key="GaadUserName" value="XXXXXX"/&amp;GT;&lt;br /&gt;     &amp;LT;add key="GaadPassword" value="XXXXXX"/&amp;GT;&lt;br /&gt;&amp;LT;/appSettings&amp;GT;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 3:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In order to store the data fetched from AD, we created a class and defined some properties.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;    public class ADContact&lt;br /&gt;    {&lt;br /&gt;        public string UniqueId {get; set; }&lt;br /&gt;        public string LastName { get; set; }&lt;br /&gt;        public string DepartmentNumber { get; set; }&lt;br /&gt;        public string EmployeeType { get; set; }&lt;br /&gt;        public string TelephoneNumber { get; set; }&lt;br /&gt;        public string FirstName { get; set; }&lt;br /&gt;        public string UserStatus { get; set; }&lt;br /&gt;        public string Mail { get; set; }&lt;br /&gt;        public string Mobile { get; set; }&lt;br /&gt;        public string Title {get; set; }&lt;br /&gt;    }&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Step 4: Create a method that will return a datatable so that we can iterate through the result.&lt;br /&gt;&lt;br /&gt;public List&lt;ADContact&gt; GetADContacts(string SirName, string GivenName, string UniqueId)&lt;br /&gt;{}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 5:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt; Within the method, create a SearchResultCollection object , a datatable, and list of AD properties to access:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt; SearchResultCollection results = null;&lt;br /&gt; List&lt;ADContact&gt; GaadData = new List&lt;ADContact&gt;();&lt;br /&gt;&lt;br /&gt; string ADLocation, ADUserId, ADUserPassword = string.Empty;&lt;br /&gt; #region List of AD Properties&lt;br /&gt; string[] properties = new string[]&lt;br /&gt; {&lt;br /&gt;    "modifyTimestamp",&lt;br /&gt;    "uid",&lt;br /&gt;    "sn",&lt;br /&gt;    "departmentNumber",&lt;br /&gt;    "facsimileTelephoneNumber",&lt;br /&gt;    "givenName",&lt;br /&gt;    "mail"&lt;br /&gt; };&lt;br /&gt; #endregion&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 6:&lt;/strong&gt;&lt;br /&gt; Declare a try-catch block and within try- write the following code:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;try {&lt;br /&gt;&lt;br /&gt;string strfilter = string.Empty;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;//Get AD Settings from web.config&lt;br /&gt;&lt;strong&gt;ADLocation = ConfigurationManager.AppSettings["ADLocation"];&lt;br /&gt;ADUserId = ConfigurationManager.AppSettings["ADUserName"];&lt;br /&gt;ADUserPassword = ConfigurationManager.AppSettings["ADPassword"];&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;//Create an instance of DirectoryEntry by passing the setting valies)              &lt;br /&gt;&lt;strong&gt;DirectoryEntry root = new DirectoryEntry(ADLocation, ADUserId, ADUserPassword, AuthenticationTypes.FastBind);&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;//Create the filter string : we need to search the Ad for people matching the search criteria. Here we are passing three parameters: SirName, GivenName, Uid. If any field is blank, we are putting * there. that is to get all values&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;strfilter = String.Format(&lt;br /&gt;            "(&amp;(&amp;(sn={0})(givenname={1})(uid={2})))",&lt;br /&gt;            String.IsNullOrEmpty(SirName) ? "*" : SirName + "*",&lt;br /&gt;            String.IsNullOrEmpty(GivenName) ? "*" : GivenName + "*",&lt;br /&gt;            String.IsNullOrEmpty(UniqueId) ? "*" : UniqueId + "*");&lt;br /&gt;            &lt;br /&gt;if (strfilter != "")&lt;br /&gt; {&lt;br /&gt; DirectorySearcher searcher = new DirectorySearcher(root, strfilter, properties);&lt;br /&gt; searcher.Asynchronous = true;&lt;br /&gt; searcher.SearchScope = SearchScope.Subtree;&lt;br /&gt; results = searcher.FindAll();&lt;br /&gt;}&lt;br /&gt;  foreach (SearchResult result in results)&lt;br /&gt;  {&lt;br /&gt;   ADContact contact = new ADContact();&lt;br /&gt;&lt;br /&gt;  if (result.Properties["uid"].Count &amp;GT; 0)&lt;br /&gt;     contact.UniqueId= Convert.ToString(result.Properties["uid"][0]);&lt;br /&gt;&lt;br /&gt;  if (result.Properties["title"].Count &amp;GT; 0)&lt;br /&gt;     contact.Title = Convert.ToString(result.Properties["title"][0]);&lt;br /&gt;&lt;br /&gt;  if (result.Properties["sn"].Count &amp;GT; 0)&lt;br /&gt;     contact.LastName = Convert.ToString(result.Properties["sn"][0]);&lt;br /&gt;&lt;br /&gt;  if (result.Properties["givenName"].Count &amp;GT; 0)&lt;br /&gt;     contact.FirstName = Convert.ToString(result.Properties["givenName"][0]);&lt;br /&gt;&lt;br /&gt;  if (result.Properties["facsimileTelephoneNumber"].Count &amp;GT; 0)&lt;br /&gt;     contact.TelephoneNumber = Convert.ToString(result.Properties["facsimileTelephoneNumber"][0]);&lt;br /&gt;&lt;br /&gt;  if (result.Properties["mobile"].Count &amp;GT; 0)&lt;br /&gt;     contact.Mobile = Convert.ToString(result.Properties["mobile"][0]);&lt;br /&gt;                       &lt;br /&gt;  if (result.Properties["mail"].Count &amp;GT; 0)&lt;br /&gt;     contact.Mail = Convert.ToString(result.Properties["mail"][0]);&lt;br /&gt;&lt;br /&gt;  ADData.Add(contact);&lt;br /&gt;  }&lt;br /&gt; return ADData;&lt;br /&gt;}&lt;br /&gt;catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                throw ex;&lt;br /&gt;            }&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-2142215274185380462?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/2142215274185380462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=2142215274185380462' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2142215274185380462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2142215274185380462'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/06/how-to-get-data-from-active-directory.html' title='How to get Data from Active Directory using C#'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-7563068309549283962</id><published>2009-06-09T21:34:00.000-07:00</published><updated>2009-06-27T09:19:12.898-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net Framework 3.5'/><title type='text'>New Features of dot Net 3.5 Framework</title><content type='html'>Dot net framework 3.5 is built on dot net 2.0 runtime library with addition of few dlls like: System.Core.dll, System.XML.LINQ.dll, System.AjaxExtension.dll etc..&lt;br /&gt;&lt;br /&gt;Mainly enhancements are done with related to LINQ and Entitiy Model. Here are few enhancements listed:&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;strong&gt;1. Automatic Properties :&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If you remember, prior to framework 3.5, we used to declare property within a class like this:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;class Class1 {&lt;br /&gt;&lt;br /&gt;privtae string _CustomerName;&lt;br /&gt;public string CustomerName &lt;br /&gt;{  &lt;br /&gt;get { return _CustomerName; }            &lt;br /&gt;set { _CustomerName = value; }&lt;br /&gt;}&lt;br /&gt;}&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now, we will see how to implement the same code in dot net 3.5:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;class Class1 {&lt;br /&gt;public string CustomerName {get; set;}&lt;br /&gt;}&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr/&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Object Initializers :&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Another new feature coming with .NET 3.5, C# 3 and VB 9 is object initialization. Object Initializers allow you to pass in named values for each of the public properties that will then be used to initialize the object. &lt;br /&gt;&lt;br /&gt;Suppose we have a class called School and few fields, we used to initialization the class like this:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;School school1=new School();&lt;br /&gt;school1.Name="ABC";&lt;br /&gt;school1.Address="DEF";&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now the problem is that if we need to initialize different fields based on logic, we need to create different constructors based on our logic. Here comes the use of Object Initializers. &lt;br /&gt;&lt;br /&gt; Object Initializers allow you to pass in any named public property to the constructor of the class. This is a great feature as it removes the need to create multiple overloaded constructors using different parameter lists to achieve the same goal. &lt;br /&gt;&lt;br /&gt;So, from framework 3.5 onwards, we will use:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;School school1=new School {&lt;br /&gt;Name="ABC";&lt;br /&gt;Address="DEF";&lt;br /&gt;};&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr/&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3. Collection Initializers :&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Like Object Initializers, the new Collection Initializers allow you to create a collection and initialize it with a series of objects in a single statement. The following statement demonstrates how the syntax is very similar to that of the Object Initializers. Initializing a List&lt;School&gt; is accomplished by passing the instances of the Customer objects wrapped inside of curly braces.&lt;br /&gt;&lt;br /&gt;Getting this feature as part of framwork, we don not need to declare the collection first and then add items to it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;List&lt;School&gt; SchoolList = new List&lt;School&gt;   &lt;br /&gt;{   &lt;br /&gt;new School {ID = 101, SchoolName = "School1"},&lt;br /&gt;new School {ID = 102, SchoolName = "School2"},&lt;br /&gt;new School {ID = 103, SchoolName = "School3"}&lt;br /&gt;};&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr/&gt;&lt;br /&gt;&lt;strong&gt;4. Extension Method&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Extension methods are a new feature that allows you to enhance an existing class by adding a new method to it without modifying the actual code for the class. This is especially useful when using LINQ because several extension methods are available in writing LINQ query expressions.&lt;br /&gt;&lt;br /&gt;For more details on extension method, check  &lt;a href="http://firstblogofvarun.blogspot.com/2009/05/using-extension-method.html"&gt;"What is Enxtension Method "&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Extension Methods are very useful when you cannot add a method to the class itself, as in the case of creating a Cube method on the int class. Just because you can use a tool, does not mean you should use a tool.&lt;br /&gt;&lt;br /&gt;&lt;hr/&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;5. Anonymous Types &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;When you create an Anonymous Type you need to declare a variable to refer to the object. Since you do not know what type you will be getting (since it is a new and anonymous type), you can declare the variable with the var keyword. This technique is called using an Implicitly Typed Variable. &lt;br /&gt;&lt;br /&gt;Chek more details on &lt;a href="http://firstblogofvarun.blogspot.com/2009/02/introduction-to-linq-part-2-anonymous.html"&gt;"All about Anonymous Types&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-7563068309549283962?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/7563068309549283962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=7563068309549283962' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7563068309549283962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7563068309549283962'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/06/new-features-of-dot-net-35-framework.html' title='New Features of dot Net 3.5 Framework'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-6707819189267297612</id><published>2009-06-09T05:07:00.000-07:00</published><updated>2009-06-27T09:19:25.076-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.Net'/><title type='text'>Steps in Compliation in ASP.NET</title><content type='html'>We all know the term compilation in Asp.Net. But do you know what is the order of compilation in an asp.net project. Do you know which folder in the application structure gets compiled first and which when get compiled last? &lt;br /&gt;&lt;br /&gt;Here is the compilation life cycle of an Asp.Net project in the order they get compiled.&lt;br /&gt;&lt;br /&gt;App_GlobalResources: First of all the global resources are compiled and the resource assembly is built. All the assembly's in the bin folder are linked to this assembly.&lt;br /&gt;&lt;br /&gt;App_WebResources: Next the web resource folder will be compiled. This will create all the proxy types for the web services. The web reference created is then linked to the resource assembly (if it exists.).&lt;br /&gt;&lt;br /&gt;Profile properties (defined in the Web.config file): If we have defined the profile properties in the web.config file than an assembly will be generated for the profile objects.&lt;br /&gt;&lt;br /&gt;App_Code: Next all the files in the App_Code folder will be compiled. All code assemblies and the profile assembly are linked to the resources and Web references assemblies if any.&lt;br /&gt;&lt;br /&gt;Global.asax: Next the Application object is compiled and then it is linked with all other previously generated assembly's. &lt;br /&gt;&lt;br /&gt;Once the top-level items are compiled, the compilation of folder, pages and other items start as and when needed. Here is a list of how this process continues?&lt;br /&gt;&lt;br /&gt;App_LocalResources: If the folder containing the requested item contains an App_LocalResources folder, the contents of the local resources folder are compiled and linked to the global resources assembly.&lt;br /&gt;&lt;br /&gt;Individual Web pages (.aspx files), &lt;br /&gt;User Controls (.ascx files), &lt;br /&gt;HTTP handlers (.ashx files), &lt;br /&gt;&lt;br /&gt;HTTP modules (.asmx files): Next these files are compiled.&lt;br /&gt;&lt;br /&gt;Themes, master pages, other source files are compiled when referenced page is compiled.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-6707819189267297612?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/6707819189267297612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=6707819189267297612' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6707819189267297612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6707819189267297612'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/06/steps-in-compliation-in-aspnet.html' title='Steps in Compliation in ASP.NET'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-8438076755727322178</id><published>2009-06-08T07:44:00.000-07:00</published><updated>2009-06-27T09:20:32.583-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OOPS'/><title type='text'>What's the difference between encapsulation and abstraction?</title><content type='html'>&lt;strong&gt;Encapsulation protects abstractions. Encapsulation is the bodyguard; abstraction is the VIP.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Encapsulation provides the explicit boundary between an object's abstract interface (its abstraction) and its internal implementation details. Encapsulation puts the implementation details "in a capsule." Encapsulation tells users which features are stable, permanent services of the object and which features are implementation details that are subject to change without notice.&lt;br /&gt;&lt;br /&gt;Encapsulation helps the developers of an abstraction: it provides the freedom to implement the abstraction in any way consistent with the interface. (Encapsulation tells developers exactly what users can and cannot access.) Encapsulation also helps the users of an abstraction: it provides protection by preventing dependence on volatile implementation details.&lt;br /&gt;&lt;br /&gt;Abstraction provides business value; encapsulation "protects" these abstractions. If a developer provides a good abstraction, users won't be tempted to peek at the object's internal mechanisms. Encapsulation is simply a safety feature that reminds users not to stray over the line inadvertently.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-8438076755727322178?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/8438076755727322178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=8438076755727322178' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8438076755727322178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8438076755727322178'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/06/whats-difference-between-encapsulation.html' title='What&apos;s the difference between encapsulation and abstraction?'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-367932516949413656</id><published>2009-06-08T07:43:00.000-07:00</published><updated>2009-06-27T09:20:41.684-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OOPS'/><title type='text'>What is an abstraction ?</title><content type='html'>An abstraction is a simplified view of an object in the user's own vocabulary.&lt;br /&gt;&lt;br /&gt;In OO ,an abstraction is the simplest interface to an object that provides all the features and services the intended users expect.&lt;br /&gt;&lt;br /&gt;An abstraction tells users everything they need to know about an object but nothing else. It is the well-defined, unambiguously specified interface. For example, on a vending machine, the abstraction is formed by the buttons and their meanings; users don't have to know about levers, internal counters, or other parts that are needed for the machine to operate. Furthermore the vending machine's price list implies a legally binding promise to users: if users put in the right amount of money, the machine promises to dispense the desired item.&lt;br /&gt;&lt;br /&gt;The key to a good abstraction is deep knowledge of the problem domain. A good abstraction allows users to use an object in a relatively safe and predictable manner. It reduces the learning curve by providing a simple interface described in terms of the user's own vocabulary.&lt;br /&gt;&lt;br /&gt;A good abstraction separates specification from implementation. It doesn't expose too much nor does it hide features that users need to know about. If an abstraction is good, users aren't tempted to peek at the object's implementation. The net result is simpler, more stable user code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-367932516949413656?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/367932516949413656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=367932516949413656' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/367932516949413656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/367932516949413656'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/06/what-is-abstraction.html' title='What is an abstraction ?'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-5791022812103903834</id><published>2009-06-07T10:03:00.000-07:00</published><updated>2009-06-27T09:20:51.758-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to use RunWithElevatedPrivileges in Sharepoint</title><content type='html'>The SPSecurity class provides a static method named &lt;strong&gt;RunWithElevatedPrivileges&lt;/strong&gt; that enables code to execute as system code running under the identity of SHAREPOINT\system. This allows code to run in an escalated security context to perform actions as the system. &lt;br /&gt;&lt;br /&gt;This method should be used with care and should not expose direct access to system resources, but rather should be used when you need to perform actions on behalf of the system. The method is simple. You can either create a delegate to a public void method or simply write code within an inline delegate. &lt;br /&gt;&lt;br /&gt;The signature looks like the following:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SPSecurity.RunWithElevatedPrivileges(delegate()&lt;br /&gt;{&lt;br /&gt;  // Code runs as the "SharePoint\system" user&lt;br /&gt;});&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Note that : &lt;br /&gt;Code running with the escalated privilege should use a new SPSite object for code running as the system and use the SPContext.Current property to access the actual calling user’s identity.&lt;br /&gt;&lt;br /&gt;To modify WSS content under the System credentials, you need to create a new SPSite site collection that generates a new security context for objects referenced from the site, as in the following example. You cannot switch the security context of the SPSite once it has been created, but must instead create a new SPSite reference to switch user contexts. The following code uses the system credentials to add a list item using the profile data of the current Web user:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SPSecurity.RunWithElevatedPrivileges(&lt;br /&gt;  delegate() {&lt;br /&gt;    using (SPSite site = new SPSite(web.Site.ID)) {&lt;br /&gt;      using (SPWeb web2 = site.OpenWeb()) {&lt;br /&gt;        SPList theList = web2.Lists["visitors"];&lt;br /&gt;        SPListItem record = theList.Items.Add();&lt;br /&gt;        record["User"] = SPContext.Current.Web.CurrentUser;&lt;br /&gt;        record.Update();&lt;br /&gt;     }&lt;br /&gt;   }&lt;br /&gt;);&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-5791022812103903834?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/5791022812103903834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=5791022812103903834' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/5791022812103903834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/5791022812103903834'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/06/how-to-use-runwithelevatedprivileges-in.html' title='How to use RunWithElevatedPrivileges in Sharepoint'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-6569824061362312881</id><published>2009-06-07T10:01:00.001-07:00</published><updated>2009-06-27T09:21:04.005-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to add a SPGroup to a Site Collection- Sharepoint</title><content type='html'>Groups cannot directly be added to a site-they must be added to the site collection.&lt;br /&gt; If you try to add a group to the site’s Groups collection, you get an exception stating, &lt;strong&gt;“You cannot add a group directly to the Groups collection. You can add a group to the SiteGroups collection.”&lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;This situation occurs because the SPGroup is always created at the Site Collection level and assigned to the site. The following code is valid and adds the LitwareSecurityGroup to the site collection groups.&lt;br /&gt;&lt;br /&gt;// Adds a new group to the site collection groups:&lt;br /&gt;&lt;strong&gt;site.SiteGroups.Add("LitwareSecurityGroup", site.CurrentUser,site.CurrentUser, "A group to manage Litware Security");&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;However, this still does not associate the group with our site, nor would it be useful within the site without any permissions. To add the group to the site, create a new SPRoleAssignment by associating an SPRoleDefinition with the SPGroup, and then add that role assignment to the site, as in the following code sample:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;SPGroup secGroup = site.SiteGroups["LitwareSecurityGroup"];&lt;br /&gt;SPRoleAssignment roleAssignment = new SPRoleAssignment(secGroup);&lt;br /&gt;SPRoleDefinition roleDefinition = site.RoleDefinitions["Full Control"];&lt;br /&gt;roleAssignment.RoleDefinitionBindings.Add(roleDefinition);&lt;br /&gt;site.RoleAssignments.Add(roleAssignment);&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-6569824061362312881?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/6569824061362312881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=6569824061362312881' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6569824061362312881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6569824061362312881'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/06/how-to-add-spgroup-to-site-collection.html' title='How to add a SPGroup to a Site Collection- Sharepoint'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-882672614672350061</id><published>2009-06-07T09:48:00.000-07:00</published><updated>2009-06-27T09:21:17.471-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to get list of SPGroups in Sharepoint Site Collection</title><content type='html'>Sharepoint Gropus (or SPGroups) are never created in the context of the site-they are always created in the context of the site collection and assigned to a site. &lt;br /&gt;&lt;br /&gt;We can get list of groups of a site by suing site.Groups&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;SPSite siteCollection = new SPSite("http://localhost/litware/sales/");&lt;br /&gt;SPWeb site = siteCollection.OpenWeb();&lt;br /&gt;&lt;br /&gt;foreach(SPGroup group in site.Groups){&lt;br /&gt;  Console.WriteLine(group.Name);&lt;br /&gt;}&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-882672614672350061?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/882672614672350061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=882672614672350061' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/882672614672350061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/882672614672350061'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/06/how-to-get-list-of-spgroups-in.html' title='How to get list of SPGroups in Sharepoint Site Collection'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-132082196611309826</id><published>2009-05-28T22:23:00.000-07:00</published><updated>2009-06-27T09:22:12.194-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net Framework 3.5'/><title type='text'>Using Extension Method</title><content type='html'>&lt;b&gt; Why Extension Method ? &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Many time we need a requirement where we need to add a new method to a class. Addition of new method is very easy if we have the class code but what if we don't have the source code of that class? We just have the dll.. &lt;br /&gt;&lt;br /&gt;One option is to inherit the existing class and add the new method or modify any existing method. The problem with this option is that it may not be possible every time due to OO Principles.&lt;br /&gt;&lt;br /&gt;Here comes the concept of &lt;b&gt;Extension Method&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to Use Extension Method &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Here is a step by step tutorial on how to use extension method.&lt;br /&gt;&lt;br /&gt;Suppose the case is that, we need to have a method called 'Next' and 'Previous' that will give us the next and previous number of the given number. &lt;br /&gt;&lt;br /&gt;We will do it by using Extension method.&lt;br /&gt;&lt;br /&gt;Step 1: Create a new Console application:&lt;br /&gt;Step 2: Add a new class Item and name it 'Ext.cs'.&lt;br /&gt;Step 3: Renamen the namespace of that class to System.&lt;br /&gt;Step 4: Add the followign code:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;   public static class Ext&lt;br /&gt;    {&lt;br /&gt;        public static int Next(this int A)&lt;br /&gt;        {&lt;br /&gt;            return A + 1;&lt;br /&gt;        }&lt;br /&gt;        public static int Previous(this int A)&lt;br /&gt;        {&lt;br /&gt;            return A - 1;&lt;br /&gt;        }&lt;br /&gt;       &lt;br /&gt;    }&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The class will look like this: &lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_AififblDFCg/Sh95POdRSII/AAAAAAAABBg/fvs1fENVfo8/s1600-h/1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 385px; height: 337px;" src="http://3.bp.blogspot.com/_AififblDFCg/Sh95POdRSII/AAAAAAAABBg/fvs1fENVfo8/s400/1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5341120985570560130" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Few things to explain:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. Namespace has been renamed to 'System' since almost all C# source files have a using System; declaration, this extension method is effectively going to be available globally &lt;br /&gt;&lt;br /&gt;2. An extension method must be static and public, must be declared inside a static class, and must have the keyword this before the first parameter type, which is the type that the method extends. Extension methods are public because they can be (and normally are) called from outside the class where they are declared.&lt;br /&gt;&lt;br /&gt;Step 5: How to use an Extension Method: &lt;br /&gt;&lt;br /&gt;We have created a public , static method using namespace System. Now the question is how to use it.&lt;br /&gt;In step 1 , we have created a console application, so in the Main method of Program.cs, write this: &lt;br /&gt;&lt;br /&gt; int a=10;&lt;br /&gt; Console.WriteLine("Number after {0} is {1}", a, a.Next());&lt;br /&gt; Console.WriteLine("Number after {0} is {1}", a, a.Previous());&lt;br /&gt; Console.ReadLine();&lt;br /&gt;&lt;br /&gt;You will notice here, as soon you type 'a' and press ., static mehtods declared in the Ext.cs will appears in intellisence and with a new symbol that marks it as extension.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_AififblDFCg/Sh97PUe56tI/AAAAAAAABBo/2Rmy35RJT-c/s1600-h/2.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 126px;" src="http://4.bp.blogspot.com/_AififblDFCg/Sh97PUe56tI/AAAAAAAABBo/2Rmy35RJT-c/s400/2.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5341123186211285714" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Step 6: Build the application and press F5:&lt;br /&gt;&lt;br /&gt;The output window will show the desired result:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_AififblDFCg/Sh97jh2XTBI/AAAAAAAABBw/MIbrwdF0TiM/s1600-h/3.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 208px; height: 78px;" src="http://3.bp.blogspot.com/_AififblDFCg/Sh97jh2XTBI/AAAAAAAABBw/MIbrwdF0TiM/s400/3.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5341123533396724754" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Although this is not a big revolution, one advantage could be Microsoft IntelliSense support, which could show all extension methods accessible to a given identifier. However, the result type of the extension method might be the extended type itself. In this case, we can extend a type with many methods, all working on the same data. LINQ very frequently uses extension methods in this way. &lt;br /&gt;&lt;br /&gt;The most common use of extension methods is to define them in static classes in specific namespaces, importing them into the calling code by specifying one or more using directives in the module.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-132082196611309826?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/132082196611309826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=132082196611309826' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/132082196611309826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/132082196611309826'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/using-extension-method.html' title='Using Extension Method'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_AififblDFCg/Sh95POdRSII/AAAAAAAABBg/fvs1fENVfo8/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-556040292423049638</id><published>2009-05-27T03:42:00.000-07:00</published><updated>2009-05-27T03:43:14.438-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ADO.NET'/><title type='text'>What is difference between dataset and datareader ?</title><content type='html'>Following are some major differences between dataset and datareader :-&lt;br /&gt;&lt;br /&gt;√ DataReader provides forward-only and read-only access to data, while the&lt;br /&gt;DataSet object can hold more than one table (in other words more than one&lt;br /&gt;rowset) from the same data source as well as the relationships between them.&lt;br /&gt;&lt;br /&gt;√ Dataset is a disconnected architecture while datareader is connected&lt;br /&gt;architecture.&lt;br /&gt;&lt;br /&gt;√ Dataset can persist contents while datareader can not persist contents, they&lt;br /&gt;are forward only.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-556040292423049638?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/556040292423049638/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=556040292423049638' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/556040292423049638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/556040292423049638'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/what-is-difference-between-dataset-and.html' title='What is difference between dataset and datareader ?'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-6234255467791662854</id><published>2009-05-27T03:39:00.000-07:00</published><updated>2009-06-27T09:22:37.613-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ADO.NET'/><title type='text'>Overview of ADO.NET architecture</title><content type='html'>The most important section in ADO.NET architecture is “Data Provider”. Data Provider&lt;br /&gt;provides access to datasource (SQL SERVER, ACCESS, ORACLE).In short it provides&lt;br /&gt;object to achieve functionalities like opening and closing connection, retrieve data and update data. In the below figure you can see the four main sections of a data provider :-&lt;br /&gt;&lt;br /&gt;Connection.&lt;br /&gt;Command object (This is the responsible object to use stored procedures)&lt;br /&gt;Data Adapter (This object acts as a bridge between datastore and dataset).&lt;br /&gt;Data Adapter (This object acts as a bridge between datastore and dataset).&lt;br /&gt;&lt;br /&gt;Dataset object represents disconnected and cached data. If you see the diagram it is not in direct connection with the data store (SQL SERVER, ORACLE etc) rather it talks&lt;br /&gt;with Data adapter, who is responsible for filling the dataset. Dataset can have one or more Datatable and relations.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_AififblDFCg/Sh0Y9SwPBaI/AAAAAAAABBY/0h7DS2-zefw/s1600-h/1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 301px;" src="http://4.bp.blogspot.com/_AififblDFCg/Sh0Y9SwPBaI/AAAAAAAABBY/0h7DS2-zefw/s400/1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5340452174416512418" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-6234255467791662854?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/6234255467791662854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=6234255467791662854' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6234255467791662854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6234255467791662854'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/overview-of-adonet-architecture.html' title='Overview of ADO.NET architecture'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_AififblDFCg/Sh0Y9SwPBaI/AAAAAAAABBY/0h7DS2-zefw/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-8779830088725797690</id><published>2009-05-27T03:13:00.000-07:00</published><updated>2009-06-27T09:22:48.224-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.Net'/><title type='text'>Introduction to ASP.NET MVC</title><content type='html'>In this session we’ll take a look at WebForms and how its request pipeline is structured, and then introduce the MVC pattern, and how it is implemented into the ASP.NET MVC framework.&lt;br /&gt;&lt;br /&gt;We’ll then discuss how WebForms and MVC differ from each other.&lt;br /&gt;Then we’ll look into the default conventions and project structure of an MVC application.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Web Forms&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_AififblDFCg/Sh0S55DA0BI/AAAAAAAABA4/nCdxheC5qJQ/s1600-h/f1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 306px;" src="http://3.bp.blogspot.com/_AififblDFCg/Sh0S55DA0BI/AAAAAAAABA4/nCdxheC5qJQ/s400/f1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5340445518906576914" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In WebForms today you start out with an ASPX page.&lt;br /&gt;Within the page you can have any number of user controls, custom controls, and server controls.&lt;br /&gt;In addition, a page can have a master page, which can in turn have any number of controls itself.&lt;br /&gt;When you introduce model data, due to the level of abstraction needed by WebForms, any of the components used can access to data.&lt;br /&gt;The page, the master page, and any of their individual controls contain logic that both retreives model data and contains it view representation.&lt;br /&gt;&lt;br /&gt;This is model that has made WebForms so successful and useful for web developers.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;WebForms uses a pattern called page controller. &lt;/strong&gt;&lt;br /&gt; When a request comes into  ASP.NET, the request is served by a specific ASPX page. Hence, the page itself serves as the controller, or face of the object that handles the request.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is MVC ?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;MVC or Model-View-Controller is an architectural pattern that separates model access from presentation logic.&lt;br /&gt;It adds specific responsibility to individual portions of the application.&lt;br /&gt;The model represents your business objects, that both houses your data, and contains business logic.&lt;br /&gt;The controller is responsible for interacting with the model, and then passing that data down to the view.&lt;br /&gt;The view’s sole responsibility is acting as a representation of the model data it is given by the controller.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_AififblDFCg/Sh0TchArM4I/AAAAAAAABBA/WqO8ZZsUX4c/s1600-h/f1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 313px;" src="http://1.bp.blogspot.com/_AififblDFCg/Sh0TchArM4I/AAAAAAAABBA/WqO8ZZsUX4c/s400/f1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5340446113749742466" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ASP.NET MVC&lt;/strong&gt;&lt;br /&gt;So now let’s see how a typical ASP.NET MVC application contrasts to the way a WebForms application looked.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_AififblDFCg/Sh0T18_U_bI/AAAAAAAABBI/WwiZUakuEcQ/s1600-h/f1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 289px;" src="http://3.bp.blogspot.com/_AififblDFCg/Sh0T18_U_bI/AAAAAAAABBI/WwiZUakuEcQ/s400/f1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5340446550757014962" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Notice that we still have our ASPX page, which in turn can leverage user controls, custom controls, and server controls. Nothing difference there.&lt;br /&gt;The page can be associated with a master page, which can in turn have its own set of user controls, custom controls, and server controls. So far this is still the same as WebForms.&lt;br /&gt;We re-introduce the model data, which is where the contrast between WebForms and MVC gets clearer.&lt;br /&gt;With WebForms, any of the controls, or page, or master page was directly interacting with the model. We introduce the controller into the picture, which will now be the orchestrator between the model and the views.&lt;br /&gt;&lt;br /&gt;Here, instead of the pages and controls directly accessing the model, the controller is strictly doing that. Once it gets the model data it is responsible for passing the data to the page, or view.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The main tenets of ASP.NET MVC are…&lt;/strong&gt;&lt;br /&gt; Alternative&lt;br /&gt; ASP.NET MVC builds on top of ASP.NET, it doesn’t replace it.  It is simply meant to serve as an alternative approach to developing web applications using ASP.NET.&lt;br /&gt;&lt;br /&gt; Testable&lt;br /&gt; While WebForms can be tested, it isn’t the most trivial task. ASP.NET MVC was built with testing in minding, so practicing TDD, or just simply writing unit tests, is a simple task with MVC.&lt;br /&gt;&lt;br /&gt; Extensible&lt;br /&gt; MVC follows the convention over configuration principle. At the same time, it isn’t meant to constrain developers by its conventions. MVC is built on an extensible framework that virtually every component can be easily replaced with your own logic.&lt;br /&gt;&lt;br /&gt; Routable&lt;br /&gt; ASP.NET MVC uses ASP.NET Routing to associate URL patterns with controller actions. This means that your MVC applications will naturally be search-engine optimized, since every controller action that corresponds to an HTTP GET can get be easily discovered.&lt;br /&gt;&lt;br /&gt; Now’s let’s briefly discuss &lt;strong&gt;the differences between WebForms and ASP.NET MVC.&lt;/strong&gt;&lt;br /&gt; While MVC is built on top of ASP.NET, it doesn’t have…&lt;br /&gt; Postbacks&lt;br /&gt; View state or control state&lt;br /&gt; Server-side form&lt;br /&gt; Page/control lifecycle&lt;br /&gt; The page/control lifecycle is still present if you’re using WebForms as your view engine, but even then, you most likely won’t be using it. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example of ASP.NET MVC&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Here we see an example of the default project structure of an ASP.NET MVC application.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_AififblDFCg/Sh0U5WzxWVI/AAAAAAAABBQ/zz1WrJQIBdQ/s1600-h/f1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 268px; height: 400px;" src="http://2.bp.blogspot.com/_AififblDFCg/Sh0U5WzxWVI/AAAAAAAABBQ/zz1WrJQIBdQ/s400/f1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5340447708739098962" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; Because ASP.NET MVC comes packaged with a set of default conventions, it’s important to understand those conventions, and even better how you can override them if you want.&lt;br /&gt; Here we see the controllers, placed in the Controllers folder. You actually don’t have to place your controllers in this folder, but it is created for you by default, and is considered a pretty standard place for them.&lt;br /&gt; The ASP.NET MVC project templates places a folder called Models in your project that can be used to contain your model classes. This is only one option for model placement, and shouldn’t be seen as guidance that this is the “right way” to do it. Your model classes are in no way coupled to their placement, so you can put them in a different folder, or even in another project if you want.&lt;br /&gt;&lt;br /&gt; Views in an ASP.NET MVC application are by default located in the Views folder. Within the Views folder, there are two options to place your views:&lt;br /&gt; Either underneath the Shared folder, which are views that are meant to be used by multiple controllers. These are typically user controls or master pages.&lt;br /&gt; Or underneath a folder named after the Controller they are associated to. These are views that are specific to controllers.&lt;br /&gt;&lt;br /&gt; This is the default convention, but it can be changed if you want. We’ll go into customizing this in the next session.&lt;br /&gt;&lt;br /&gt; The route definitions that map URL patterns to your controllers are declared within your application’s Global.asax file. This way they can be created upon Application Start.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-8779830088725797690?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/8779830088725797690/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=8779830088725797690' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8779830088725797690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8779830088725797690'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/introduction-to-aspnet-mvc.html' title='Introduction to ASP.NET MVC'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_AififblDFCg/Sh0S55DA0BI/AAAAAAAABA4/nCdxheC5qJQ/s72-c/f1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-145955415392639498</id><published>2009-05-27T03:08:00.000-07:00</published><updated>2009-06-27T09:22:56.656-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><title type='text'>LINQ Architecture and Components</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_AififblDFCg/Sh0RJvY5HPI/AAAAAAAABAw/1aJASJuT5BM/s1600-h/linqarc.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 299px;" src="http://3.bp.blogspot.com/_AififblDFCg/Sh0RJvY5HPI/AAAAAAAABAw/1aJASJuT5BM/s400/linqarc.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5340443592168643826" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;LINQ is currently integrated directly into the native syntax for both C# 3.0 and VB 9.0 – which are included with Visual Studio 2008 &lt;br /&gt;&lt;br /&gt;Other languages may also support Language Integrated Query syntax in the future. &lt;br /&gt;There are many flavors of LINQ which we describe by the type of data it operates over. As you can see here, LINQ may operate over Objects, SQL, Datasets, and XML. &lt;br /&gt;&lt;br /&gt;These are the four flavors of LINQ that we are shipping with the .NET Framework 3.5&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;LINQ to Objects&lt;/strong&gt;&lt;br /&gt;SQL-like queries for any .NET collection (or anything that implements Ienumerable)&lt;br /&gt;The LINQ to Objects API supports queries over any .NET collection, such as arrays and generic lists.&lt;br /&gt;&lt;br /&gt;This API is defined in the System.Linq namespaces inside System.Core.dll&lt;br /&gt;LINQ to objects is enabled by including the System.Linq namespace.&lt;br /&gt;Manipulating collections of objects, which can be related to each other to form a hierary or a graph.  From a certain point of view, LINQ to Objects is the default implementation used by a LINQ query.   &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;LINQ to SQL&lt;/strong&gt;&lt;br /&gt;Query enabled data access framework&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;LINQ to XML&lt;/strong&gt;&lt;br /&gt;Query enabled, smaller, faster XML DOM&lt;br /&gt;&lt;br /&gt;The important thing to remember is that the querying syntax used in LINQ is consistent regardless of the type of data you’re working with. &lt;br /&gt;&lt;br /&gt;FAQ&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Will there be support for Oracle with LINQ to SQL?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;There is no provider model for DLINQ.  In order for a third party provider to support DLINQ, they would need to produce an entire API that mirrors DLINQ that covers everything from query generation to examining attributes on classes to providing a designer to interact with the database schema.  Because there's a lower bar for enhancing a provider to support the Entity Framework (primarily just query generation), Oracle is only planning to support the Entity Framework.&lt;br /&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-145955415392639498?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/145955415392639498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=145955415392639498' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/145955415392639498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/145955415392639498'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/linq-architecture-and-components.html' title='LINQ Architecture and Components'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_AififblDFCg/Sh0RJvY5HPI/AAAAAAAABAw/1aJASJuT5BM/s72-c/linqarc.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-727734105146380564</id><published>2009-05-27T03:06:00.001-07:00</published><updated>2009-06-27T09:23:06.664-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><title type='text'>Introducing LINQ</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_AififblDFCg/Sh0Qn9E6oHI/AAAAAAAABAo/ytu3QgT7JBY/s1600-h/2.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 283px;" src="http://1.bp.blogspot.com/_AififblDFCg/Sh0Qn9E6oHI/AAAAAAAABAo/ytu3QgT7JBY/s400/2.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5340443011727401074" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Orcas significantly improves the way developers handle data.&lt;br /&gt;Traditionally developers have manipulated data differently depending on where the data resides and how the user connects to it. &lt;br /&gt;&lt;br /&gt;With the introduction of &lt;strong&gt;Language Integrated Query&lt;/strong&gt; developers can now deal with data using a consistent programmatic approach and perform data access with new data design surfaces. &lt;br /&gt;  &lt;br /&gt;LINQ aimes to reduce the complexity for developers and help boost their productivity through a set of extensions to the C# and Visual Basic programming languages as well as the Microsoft .NET Framework, which provides integrated querying for objects, databases, and XML data.&lt;br /&gt;&lt;br /&gt;Using LINQ, developers will be able to write queries natively in C# or Visual Basic without having to use specialized languages, such as Structured Query Language (SQL) and Xpath.&lt;br /&gt;&lt;br /&gt;With Visual Studio “Orcas”, you can work with data in the way that you want. You can create entire collections of objects from a database backend if you like. You can interact with data as rows or columns – whatever makes sense to your application. &lt;br /&gt;Language Integrated Query or “LINQ” will dramatically change the way we work with and program against data. By creating a common querying language in LINQ, we’ve freed you, the developer to focus on things that matter most to you. LINQ will provide you the ease of use you’ve come to expect with Visual Studio offering both IntelliSense and Autocompletion right in the IDE. &lt;br /&gt;&lt;br /&gt;Language Integrated Query provides native querying syntax in C# and VB.Net. This frees the developer from having to master independent data programmability technologies (e.g. Xpath, Xquery, T/SQL) and instead offers the developer a consistent way to query data. &lt;br /&gt;&lt;br /&gt;The best part is that the LINQ code you write is consistent whether your data store is a SQL Server, contained in a ADO.NET DataSet, an XML document, an EDM you create or even objects you create in memory. &lt;br /&gt;&lt;br /&gt;With Orcas, we have taken a more general approach and are adding general purpose query facilities to the .NET Framework that apply to all sources of information, not just relational or XML data. &lt;br /&gt;&lt;br /&gt;This facility is called .NET Language Integrated Query (LINQ). &lt;br /&gt;With Orcas and ADO.NET 3.5, LINQ is an inherent part of the C# and VB.Net languages offering both IntelliSense and Autocompletion. &lt;br /&gt;&lt;br /&gt;LINQ provides developers with a consistent query language which they in turn may use on various types of data. Be it Objects, XML, Datasets, SQL Server (or other databases with ADO.NET providers) and Entities. Any data that may be placed into a .NET collection of type IEnumerable&lt;T&gt; can be queried by LINQ. &lt;br /&gt;&lt;br /&gt;If you’ve written T/SQL in the past then LINQ will offer you familiar constructs for projections, restrictions, sorting and grouping such as Select, Where, GroupBy, and OrderBy. &lt;br /&gt;&lt;br /&gt;You can also adapt the query operators to your liking by using extension methods which can override their default behavior.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-727734105146380564?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/727734105146380564/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=727734105146380564' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/727734105146380564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/727734105146380564'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/introducing-linq.html' title='Introducing LINQ'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_AififblDFCg/Sh0Qn9E6oHI/AAAAAAAABAo/ytu3QgT7JBY/s72-c/2.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-7457511113904205405</id><published>2009-05-27T03:01:00.000-07:00</published><updated>2009-06-27T09:24:51.466-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net Framework 3.5'/><title type='text'>.Net Framework and VS Roadmap</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_AififblDFCg/Sh0QCGCQoFI/AAAAAAAABAg/4qChDvl3QFI/s1600-h/1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://4.bp.blogspot.com/_AififblDFCg/Sh0QCGCQoFI/AAAAAAAABAg/4qChDvl3QFI/s400/1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5340442361297150034" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;.NET Framework 3.0&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;First, if we travel back in time to November of 2006, Microsoft released the .NET Framework 3.0.&lt;br /&gt;&lt;br /&gt;.NET Framework 3.0 was installed by default with Windows Vista, however, it was also available as a installable component for Windows XP SP2 and Windows Server 2003.  &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Visual Studio Extensions&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;When we released the .NET Framework 3.0, we also released a couple of extensions for Visual Studio.&lt;br /&gt;&lt;br /&gt;The first extensions, called the Visual Studio 2005 Extensions for Windows Workflow Foundation, provided templates and design-time support for creating workflows within Visual Studio. It is worth noting that this was a complete and fully supported set of extensions.&lt;br /&gt;&lt;br /&gt;The second extensions were the Visual Studio Extensions for the Windows Communication Foundation and Windows Presentation Foundation November CTP.    &lt;br /&gt;&lt;br /&gt;These extensions simply provided project and item templates for building WCF services and WPF applications.  &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ASP.NET Ajax&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Shortly after the release of the .NET Framework 3.0, Microsoft also released the ASP.NET AJAX 1.0 extensions.&lt;br /&gt;These extensions are designed to enable web developers to build dynamic applications with ASP.NET 2.0.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Visual Studio 2008 and .NET Framework 3.5&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;It’s important to understand these out-of-band releases as we look at Visual Studio 2008 and the .NET Framework 3.5.   Visual Studio 2008 and the .NET Framework 3.5 include enhanced versions of the technologies that have been released out-of-band, such as AJAX and design time support for WF, WPF, and WCF applications.   &lt;br /&gt;At this point in time the beta 2 release of Visual Studio 2008 and the .NET Framework 3.5 are available.   &lt;br /&gt;&lt;br /&gt;It is also worth mentioning that there is a go-live license available with the .NET Framework 3.5.  So you can deploy applications into production using this license.   To be clear, there is a difference between licensed and supported.  The .NET Framework 3.5 will not be supported until it is officially released.   &lt;br /&gt;Visual Studio 2008 and the .NET Framework 3.5 are scheduled to be released at the end of 2007 and they will launch with Windows Server 2008 and SQL Server 2008 on Februrary 27th.  &lt;br /&gt;&lt;br /&gt;Beyond the release of Visual Studio 2008 and the .NET Framework 3.5&lt;br /&gt;After the release of these technologies, there will be an update to the .NET Framework that will be released with SQL Server 2008.   This update will add support for the ADO.NET Entity Framework, which will enable flexible data access to a variety of data stores.&lt;br /&gt;&lt;br /&gt;Finally, next year we plan to release a major update to Visual Studio Team System and Team Foundation Server codenamed “Rosario”.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-7457511113904205405?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/7457511113904205405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=7457511113904205405' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7457511113904205405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7457511113904205405'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/net-framework-and-vs-roadmap.html' title='.Net Framework and VS Roadmap'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_AififblDFCg/Sh0QCGCQoFI/AAAAAAAABAg/4qChDvl3QFI/s72-c/1.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-1605896014820740151</id><published>2009-05-27T02:58:00.000-07:00</published><updated>2009-06-27T09:25:10.186-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net Framework 3.5'/><title type='text'>What is .Net Framework  3.5 ?</title><content type='html'>Do you or any of your customers suffer from…version confusion?   I’m referring to .NET Framework versioning confusion.I know that I have frequently been asked by customers questions like:&lt;br /&gt;&lt;br /&gt;So what is the .NET Framework 3.5?   &lt;br /&gt;&lt;br /&gt;There is a fair amount of confusion about the different versions of the .NET Framework.  It’s important that we spend a few minutes to clarify any confusion that might exist in this room.  &lt;br /&gt;&lt;br /&gt;Let’s walk through this diagram:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_AififblDFCg/Sh0PENvX6-I/AAAAAAAABAY/DfWvWn8VcNk/s1600-h/dotnet3.5.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 299px;" src="http://3.bp.blogspot.com/_AififblDFCg/Sh0PENvX6-I/AAAAAAAABAY/DfWvWn8VcNk/s400/dotnet3.5.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5340441298213530594" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.NET Framework 3.5&lt;br /&gt;&lt;br /&gt;The .NET Framework 3.5 is an incremental release of the .NET Framework.  It provides several new enhancements including LINQ, ASP.NET 3.5, the CLR Add-in framework and several others.&lt;br /&gt;&lt;br /&gt;The .NET Framework 3.5 builds upon the previous versions of the framework, namely the .NET Framework 2.0 and 3.0.   More specifically, you can think of it as though the .NET Framework 3.5 has a dependency on the .NET Framework 3.0 with SP1 and 2.0 with SP1.   &lt;br /&gt;&lt;br /&gt;.NET Framework 3.0&lt;br /&gt;&lt;br /&gt;The .NET Framework 3.0, which was formerly known as WinFx, introduced several key new technologies including:&lt;br /&gt;&lt;br /&gt;Windows Presentation Foundation – provides the ability to build rich, interactive client applications&lt;br /&gt;Windows Communication Foundation – provides a common programming model for building services and connecting applications&lt;br /&gt;Windows Workflow Foundation – provides the ability to define declarative, long-running workflows&lt;br /&gt;Windows CardSpace – provides a safer and more secure alternative to username and password authentication within web sites and rich client applications&lt;br /&gt;&lt;br /&gt;.NET Framework 2.0&lt;br /&gt;&lt;br /&gt;Finally, the .NET Framework 2.0, which was initially released in 2005 provides the common language runtime and base class libraries that are used by the .NET Framework 3.0 and 3.5 components.  &lt;br /&gt;&lt;br /&gt;So how will developers get the .NET Framework 3.5?  &lt;br /&gt; &lt;br /&gt;The .NET Framework 3.5 will be available as an optional update through Windows Update, as a bootstrapper installation, and as a full package.&lt;br /&gt;&lt;br /&gt;With all of these packages, your machine will be examined during the installation and the .NET Framework 2.0 with SP1, 3.0 with SP1, and the new 3.5 assemblies will be installed.&lt;br /&gt;&lt;br /&gt;The setup for the .NET Framework 3.5 will only install the necessary bits.   So if the .NET Framework 2.0 or 3.0 is already installed, then only the service packs and the 3.5 bits will be added.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-1605896014820740151?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/1605896014820740151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=1605896014820740151' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1605896014820740151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1605896014820740151'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/what-is-net-framework-35.html' title='What is .Net Framework  3.5 ?'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_AififblDFCg/Sh0PENvX6-I/AAAAAAAABAY/DfWvWn8VcNk/s72-c/dotnet3.5.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-2324542666181496100</id><published>2009-05-23T01:22:00.001-07:00</published><updated>2009-06-27T09:25:38.182-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.Net'/><title type='text'>Creating a WebService in ASP.NET , C#</title><content type='html'>This post deals with the basic theory of the web service.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is a Web Service?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Web Services can convert your applications into Web-applications.&lt;br /&gt;&lt;br /&gt;•Web services are application components&lt;br /&gt;•Web services communicate using open protocols&lt;br /&gt;•Web services are self-contained and self-describing&lt;br /&gt;•Web services can be discovered using UDDI&lt;br /&gt;•Web services can be used by other applications&lt;br /&gt;•XML is the basis for Web services&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How Does it Work?&lt;/strong&gt;&lt;br /&gt;The basic Web services platform is XML + HTTP.&lt;br /&gt;&lt;br /&gt;XML provides a language which can be used between different platforms and programming languages and still express complex messages and functions.&lt;br /&gt;&lt;br /&gt;The HTTP protocol is the most used Internet protocol.&lt;br /&gt;&lt;br /&gt;Creating and consuming web service is done in 3 broader steps:&lt;br /&gt;&lt;br /&gt;A. Create a Web Service class and method&lt;br /&gt;B. Add Web-Reference to the project&lt;br /&gt;C. Consume the created web service in the ASP.NET code.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;A. Create a Web Service class and method&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 1: Creating Web Project&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Open Visual Studio and create a new Web Site. Name it whatever you want. Here, it is named WSDemo.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_AififblDFCg/She_uCS8yMI/AAAAAAAAA-I/xKmCWB3GNRo/s1600-h/1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 260px;" src="http://2.bp.blogspot.com/_AififblDFCg/She_uCS8yMI/AAAAAAAAA-I/xKmCWB3GNRo/s400/1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338946680882251970" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 2: Adding New Item&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;A new web project will open with a default.aspx and aspx.cs file. Right Click on project and click 'Add New Item'.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_AififblDFCg/ShfAJe0ahGI/AAAAAAAAA-Q/hl8_R0tL5oU/s1600-h/2.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 344px; height: 175px;" src="http://1.bp.blogspot.com/_AififblDFCg/ShfAJe0ahGI/AAAAAAAAA-Q/hl8_R0tL5oU/s400/2.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338947152395273314" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This will open the 'Add New Item' Dialoge box. Select template 'Web Service' and name it WS.asmx.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_AififblDFCg/ShfAbAxB3RI/AAAAAAAAA-Y/_3SCW26wTCg/s1600-h/3.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 265px;" src="http://3.bp.blogspot.com/_AififblDFCg/ShfAbAxB3RI/AAAAAAAAA-Y/_3SCW26wTCg/s400/3.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338947453565656338" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You will notice that two new files has been added: WS.aspx and WS.cs under App_Code&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_AififblDFCg/ShfAvmtBdcI/AAAAAAAAA-g/RdR9e5_ASww/s1600-h/4.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 233px; height: 261px;" src="http://1.bp.blogspot.com/_AififblDFCg/ShfAvmtBdcI/AAAAAAAAA-g/RdR9e5_ASww/s400/4.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338947807346783682" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Adding a web service file will add WS.asmx file. If you open the WS.cs file, you will notice lot of pre-coded lines there. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_AififblDFCg/ShfBWLUBxTI/AAAAAAAAA-o/CUbZrytawD4/s1600-h/5.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 216px;" src="http://3.bp.blogspot.com/_AififblDFCg/ShfBWLUBxTI/AAAAAAAAA-o/CUbZrytawD4/s400/5.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338948470009087282" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A class must inherit &lt;strong&gt;System.Web.Services.WebService &lt;/strong&gt;in order to behave like a web service.&lt;br /&gt;&lt;br /&gt;Also, a HelloWorld method is added by default. The normal method can be converted to a webmethod by adding the following line on top of that method:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;[WebMethod]&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 3: Adding Custom Code:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;My objective is to write a webmethod that will accept two parameters and return the sum of those two numbers. So, I removed the HelloWorld method and added my own Add Method.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;[WebMethod]&lt;br /&gt;public int Add(inta, int b)&lt;br /&gt;{&lt;br /&gt; return a+b;&lt;br /&gt;}&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_AififblDFCg/ShfCisd9BvI/AAAAAAAAA-w/r6hc9fY5aOk/s1600-h/6.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 201px;" src="http://1.bp.blogspot.com/_AififblDFCg/ShfCisd9BvI/AAAAAAAAA-w/r6hc9fY5aOk/s400/6.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338949784579147506" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;At this point, your webservice clas is ready.&lt;br /&gt;&lt;br /&gt;In order to test whether web service is created successfully or not, build the website and right click the WS.asmx and click 'View in Browser'. This action will open the webservice in browser and display the webmethod as a link.&lt;br /&gt;&lt;br /&gt;Clicking on the WebMethod will ask for the input parameters that we defined (a, b) and submitting the form will show the result in a xml file.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;B. Add Web-Reference to the project&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now when the web service has been developed, we need to add the web reference to the project. In order to do so , follow these steps:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 1: Click Add WebReference&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Right click the project and select 'Add Web Reference'&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_AififblDFCg/ShfEX_T-PhI/AAAAAAAAA-4/fO9icDJ2AFA/s1600-h/7.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 334px; height: 300px;" src="http://3.bp.blogspot.com/_AififblDFCg/ShfEX_T-PhI/AAAAAAAAA-4/fO9icDJ2AFA/s400/7.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338951799682252306" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 2: Browse for the web service&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This action will open the 'Add Web Reference' wizard. It will ask use rto select the location where the web service is their. Since for our purpose, web service is in the solution, click 'Web Service in the solution'&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_AififblDFCg/ShfE18ppKHI/AAAAAAAAA_A/XlzGdPZFrzk/s1600-h/8.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 281px;" src="http://2.bp.blogspot.com/_AififblDFCg/ShfE18ppKHI/AAAAAAAAA_A/XlzGdPZFrzk/s400/8.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338952314363914354" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 3: Selecting the web service:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Select the web service 'WS'. This will check the webservice 'WS' and list out all the WebMethods. During this process, you will see a progress bar liek this:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_AififblDFCg/ShfFcuYJ3QI/AAAAAAAAA_I/XdcRsPaFimU/s1600-h/10.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 177px; height: 42px;" src="http://1.bp.blogspot.com/_AififblDFCg/ShfFcuYJ3QI/AAAAAAAAA_I/XdcRsPaFimU/s400/10.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338952980547362050" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 4: Defining namespace and adding the reference:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;After the internal process, wizard will list out the webmethods found in that webservice. If you chek the image below, there are few things to notice:&lt;br /&gt;&lt;br /&gt;i.   URL : That is the url fo the webservice. You can access the webservice WS directly from browser also.&lt;br /&gt;&lt;br /&gt;ii.  Webmethod Name: 'Add' is the name of our web method.&lt;br /&gt;&lt;br /&gt;iii. Web Reference Name: This will be the namespace of the webservice.You can change it to your desired name. For demo purpose, I have kept it the default 'localhost'.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_AififblDFCg/ShfN6PcjW0I/AAAAAAAAA_Y/1pV3E4w3OU0/s1600-h/11.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 281px;" src="http://1.bp.blogspot.com/_AififblDFCg/ShfN6PcjW0I/AAAAAAAAA_Y/1pV3E4w3OU0/s400/11.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338962283733408578" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Clicking 'Add Reference' will add the web reference to the project and add the following files:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_AififblDFCg/ShfPFxFbqMI/AAAAAAAAA_g/lgBTiEY3MpQ/s1600-h/14.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 199px; height: 241px;" src="http://4.bp.blogspot.com/_AififblDFCg/ShfPFxFbqMI/AAAAAAAAA_g/lgBTiEY3MpQ/s400/14.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338963581253429442" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here 'localhost' is the namespace. There are discovery file and WSDL file. I will explain the file types in next post..&lt;br /&gt;&lt;br /&gt;This means web-reference has been added.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;C. Consume the created web service in the ASP.NET code.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now after creating and adding reference, we need to consume the web service.&lt;br /&gt;&lt;br /&gt;Step 1: Modify the ASP.NET page:&lt;br /&gt;&lt;br /&gt;In the default.aspx, add the following code:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_AififblDFCg/ShfPyv-YhLI/AAAAAAAAA_o/hy9rdrQZdvE/s1600-h/15.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 115px;" src="http://4.bp.blogspot.com/_AififblDFCg/ShfPyv-YhLI/AAAAAAAAA_o/hy9rdrQZdvE/s400/15.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338964354049541298" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&amp;LT;form id="form1" runat="server"&amp;GT;&lt;br /&gt;&amp;LT;div&amp;GT;&lt;br /&gt;Enter value 1:&amp;LT;asp:TextBox ID="A" runat="server"/&amp;GT;&lt;br /&gt;Enter value 2:&amp;LT;asp:TextBox ID="B" runat="server"/&amp;GT;&lt;br /&gt;&amp;LT;asp:Button id="btnSubmit" runat="server" Text="Add" onclick="btnSubmit_Click" /&amp;GT;&lt;br /&gt;&amp;LT;hr /&amp;GT;&lt;br /&gt;Sub Result: &amp;LT;asp:Label id="lbl" runat="server"/&amp;GT;&lt;br /&gt;&amp;LT;/div&amp;GT;&lt;br /&gt;&amp;LT;/form&amp;GT;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now we need to access the webservice from code. That we do by referring the namespace 'localhost'.&lt;br /&gt;&lt;br /&gt;In the btnSubit Click event , add the following code:&lt;br /&gt;&lt;br /&gt;localhost.WebService AddService=new localhost.WebService();&lt;br /&gt;lbl.Text=AddService.Add(Int32.Parse(A.Text),Int32.Parse(B.Text)).ToString();&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_AififblDFCg/ShfSi4V2znI/AAAAAAAAA_w/hqLdhJTjP6Q/s1600-h/16.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 55px;" src="http://3.bp.blogspot.com/_AififblDFCg/ShfSi4V2znI/AAAAAAAAA_w/hqLdhJTjP6Q/s400/16.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338967379952455282" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Finally, build the website and run the application, default.aspx will open .Enter two values and click 'Add'.&lt;br /&gt;The result will be shown in the label.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_AififblDFCg/ShfUpRt-HpI/AAAAAAAAA_4/kO7lgMy7Pwg/s1600-h/17.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 355px; height: 169px;" src="http://1.bp.blogspot.com/_AififblDFCg/ShfUpRt-HpI/AAAAAAAAA_4/kO7lgMy7Pwg/s400/17.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5338969688866954898" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Please feel free to contact me if you have any query..&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-2324542666181496100?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/2324542666181496100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=2324542666181496100' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2324542666181496100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2324542666181496100'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/creating-webservice-in-aspnet-c.html' title='Creating a WebService in ASP.NET , C#'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_AififblDFCg/She_uCS8yMI/AAAAAAAAA-I/xKmCWB3GNRo/s72-c/1.JPG' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-4898630673616627007</id><published>2009-05-21T00:05:00.000-07:00</published><updated>2009-06-27T09:25:49.016-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Difference between .Dwp and .Webpart</title><content type='html'>In the development of webpart, we have encountered two types of files.&lt;br /&gt;&lt;br /&gt;1. .Dwp and 2. .Webpart.&lt;br /&gt;&lt;br /&gt;As you may know, they are both files used for describing where the code is for a web part.  &lt;br /&gt;&lt;br /&gt;The difference is .dwp was the file extension used in version 2 of SharePoint and .webpart is a new extension used in version 3.  &lt;br /&gt;&lt;br /&gt;Inside the files, the schemas are different and it is indicated as such by the version number on the xmlns attribute.&lt;br /&gt;&lt;br /&gt;The main difference is that all properties passed to the web part are specified with a property element and a name attribute in version 3.  Version 2 uses different element names for everything.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-4898630673616627007?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/4898630673616627007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=4898630673616627007' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4898630673616627007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4898630673616627007'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/difference-between-dwp-and-webpart.html' title='Difference between .Dwp and .Webpart'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-952733013896282752</id><published>2009-05-20T22:43:00.000-07:00</published><updated>2009-06-27T09:25:58.496-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Various properties of PeopleEditor:</title><content type='html'>Various properties of PeopleEditor:&lt;br /&gt;&lt;br /&gt;The PeopleEditor control has a number of properties that allow you to configure it. In the next section, we will discuss the properties that we think are most important. &lt;br /&gt;&lt;br /&gt;The PlaceButtonsUnderEntityEditor property decides the location of the Names and Browse buttons of the people picker. If you set it to true, the buttons are placed at the bottom right corner of the account name text box, otherwise to the right of it.&lt;br /&gt;&lt;br /&gt;The AllowEmpty property lets you define if the user is required to fill in a value in the people picker.&lt;br /&gt;&lt;br /&gt;The SelectionSet property allows you to define the set of users and groups the people picker can choose from. This set can consist of users, Active Directory distribution lists, Active Directory security groups, and SharePoint groups.&lt;br /&gt;The MultiSelect property lets you define if a user is allowed to specify multiple user accounts. The next code fragment shows how to add a people picker to a web part and how to configure it: &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;objEditor = new PeopleEditor();&lt;br /&gt;objEditor.AutoPostBack = true;&lt;br /&gt;objEditor.PlaceButtonsUnderEntityEditor = true;&lt;br /&gt;objEditor.ID = "pplEditor";&lt;br /&gt;objEditor.AllowEmpty = false;&lt;br /&gt;objEditor.SelectionSet = "User,SecGroup,SPGroup";&lt;br /&gt;objEditor.MultiSelect = false;&lt;br /&gt;Controls.Add(objEditor);&lt;/strong&gt;&lt;br /&gt;You can retrieve the values selected in the people picker by looping through the ResolvedEntities collection of the PeopleEditor object.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-952733013896282752?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/952733013896282752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=952733013896282752' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/952733013896282752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/952733013896282752'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/various-properties-of-peopleeditor.html' title='Various properties of PeopleEditor:'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-6899819964632990024</id><published>2009-05-20T21:24:00.000-07:00</published><updated>2009-06-27T09:26:08.709-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to get all the values of PeopleEditor in Sharepoint</title><content type='html'>If we need to acess oll the values in the PeopleEditor control, we can iterate through the entities present in PeopleEditor:&lt;br /&gt;&lt;br /&gt;Suppose we have a PeopleEditor control PE1 so the code will be :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ArrayList entities = PE1.ResolvedEntities;&lt;br /&gt;foreach (object entity in entities)&lt;br /&gt;{&lt;br /&gt;   PickerEntity pickerEntity = (PickerEntity)entity;&lt;br /&gt;   string accountName = pickerEntity.Key;&lt;br /&gt;   string displayName = pickerEntity.DisplayText;&lt;br /&gt;   // pickerEntity.EntityDate[] has other values like first name, last name, etc you might be interested in.&lt;br /&gt;}&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-6899819964632990024?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/6899819964632990024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=6899819964632990024' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6899819964632990024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6899819964632990024'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/how-to-get-all-values-of-peopleeditor.html' title='How to get all the values of PeopleEditor in Sharepoint'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-5161508313144343456</id><published>2009-05-20T21:18:00.000-07:00</published><updated>2009-06-27T09:26:42.236-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to check if PeopleEditor is blank ?</title><content type='html'>Sometimes, we need to check whether Sharepoint PeopleEditor is blank or not. We can do that very easily by accessing Length property of that control.&lt;br /&gt;&lt;br /&gt;Suppose we have a PeopleEditor control with Id PE1 then check for the lenght like this:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Int32 intLength = PE1.CommaSeparatedAccounts.Length;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Then put your own business logic as : &lt;br /&gt;&lt;br /&gt; if (intLength == 0) &lt;br /&gt;            {.... }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-5161508313144343456?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/5161508313144343456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=5161508313144343456' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/5161508313144343456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/5161508313144343456'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/how-to-check-if-peopleeditor-is-blank.html' title='How to check if PeopleEditor is blank ?'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-6314556463479598179</id><published>2009-05-20T21:12:00.000-07:00</published><updated>2009-06-27T09:26:54.080-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to set current user in the PeopleEditor via Code</title><content type='html'>The following code sample will set the currently logged on user to a PeopleEditor:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;using (SPWeb web = SPContext.Current.Web)&lt;br /&gt;{    &lt;br /&gt;SPUser user = web.CurrentUser;    &lt;br /&gt;PickerEntity entity = new PickerEntity();    &lt;br /&gt;entity.Key = user.LoginName.ToString();    &lt;br /&gt;System.Collections.ArrayList entityArrayList = new System.Collections.ArrayList();    &lt;br /&gt;entityArrayList.Add(entity);    &lt;br /&gt;PeopleEditorControl.UpdateEntities(entityArrayList);&lt;br /&gt;}&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-6314556463479598179?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/6314556463479598179/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=6314556463479598179' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6314556463479598179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6314556463479598179'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/how-to-set-current-user-in-peopleeditor.html' title='How to set current user in the PeopleEditor via Code'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-7929783176856668166</id><published>2009-05-20T02:03:00.000-07:00</published><updated>2009-06-27T09:27:02.114-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to check whether a List is a Document Library?</title><content type='html'>Many times, we face a situation where we iterate through list collection. Now if we need to check whether a list is a SPDocumentLibrary or not, we can check it in very simple manner:&lt;br /&gt;&lt;br /&gt;Suppose we need to display list of document libraries present in a site in a dropdown control named 'lstTargetLibrary', we will iterate through list collection and check for List type:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SPWeb site = SPContext.Current.Web;&lt;br /&gt;foreach (SPList list in site.Lists) {&lt;br /&gt;  if (list is SPDocumentLibrary &amp;&amp; !list.Hidden) {&lt;br /&gt;    SPDocumentLibrary docLib = (SPDocumentLibrary)list;&lt;br /&gt;&lt;br /&gt;    lstTargetLibrary.Items.Add(&lt;br /&gt;       new ListItem(docLib.Title, docLib.ID.ToString()));&lt;br /&gt;  }&lt;br /&gt;}&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-7929783176856668166?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/7929783176856668166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=7929783176856668166' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7929783176856668166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7929783176856668166'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/how-to-check-wheter-list-is-document.html' title='How to check whether a List is a Document Library?'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-970020563099466828</id><published>2009-05-20T01:34:00.000-07:00</published><updated>2009-06-27T09:27:10.512-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to Upload a File to a SharePoint Site from a Local Folder</title><content type='html'>This code sample will show how to upload a file from your local pc to Sharepoint site using object mode:&lt;br /&gt;&lt;br /&gt;1. Create a project and import namespaces :&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;using System.IO;&lt;br /&gt;using Microsoft.SharePoint;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;2. The UploadFile funtion code:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;public void UploadFile(string srcUrl, string destUrl)&lt;br /&gt;{&lt;br /&gt;    if (! File.Exists(srcUrl))&lt;br /&gt;    {&lt;br /&gt;        throw new ArgumentException(String.Format("{0} does not exist", &lt;br /&gt;            srcUrl), "srcUrl");&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    SPWeb site = new SPSite(destUrl).OpenWeb();&lt;br /&gt;&lt;br /&gt;    FileStream fStream = File.OpenRead(srcUrl);&lt;br /&gt;    byte[] contents = new byte[fStream.Length];&lt;br /&gt;    fStream.Read(contents, 0, (int)fStream.Length);&lt;br /&gt;    fStream.Close(); &lt;br /&gt;&lt;br /&gt;    EnsureParentFolder(site, destUrl);&lt;br /&gt;    site.Files.Add(destUrl, contents);&lt;br /&gt;}&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The UploadFile method accepts two parameters. The srcUrl parameter specifies the path of the source location in the file system of the local computer, and the destUrl parameter specifies the absolute URL of the destination. A System.IO.FileStream object is used to read the source file into a byte array for use with the Add method of the SPFileCollection class. &lt;br /&gt;&lt;br /&gt;To upload a file from a local folder on the same server that is running Windows SharePoint Services, you can use a System.IO.FileStream object instead. In this case, add a using directive for the System.IO namespace, in addition to directives for System and Microsoft.SharePoint. The following example uses the Click event handler to call an UploadFile method, which in turn calls the previously described EnsureParentFolder method.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-970020563099466828?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/970020563099466828/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=970020563099466828' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/970020563099466828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/970020563099466828'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/how-to-upload-file-to-sharepoint-site.html' title='How to Upload a File to a SharePoint Site from a Local Folder'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-6328173684479262140</id><published>2009-05-20T01:33:00.001-07:00</published><updated>2009-06-27T09:27:20.317-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to delete a List from Sharepoint ?</title><content type='html'>This small code snippets will demonstrate how to delete a SPList from a sharepoint site.&lt;br /&gt;&lt;br /&gt;To delete a list, you must specify the GUID of the list as the parameter for the Delete method. Use the ID property of the SPList class to find the GUID.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SPWeb mySite = SPContext.Current.Web;&lt;br /&gt;SPListCollection lists = mySite.Lists;&lt;br /&gt;&lt;br /&gt;SPList list = lists[ListName];&lt;br /&gt;System.Guid listGuid = list.ID;&lt;br /&gt;&lt;br /&gt;lists.Delete(listGuid);&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-6328173684479262140?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/6328173684479262140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=6328173684479262140' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6328173684479262140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6328173684479262140'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/how-to-delete-list-from-sharepoint.html' title='How to delete a List from Sharepoint ?'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-8716900239870713828</id><published>2009-05-19T05:20:00.000-07:00</published><updated>2009-06-27T09:27:32.499-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Difference between Update and SystemUpdate in Sharepoint</title><content type='html'>We all know that whenever we add a list item or do some modification, we update the list. Here we have two options:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. List.Update() and 2. List.SystemUpdate()&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The main difference betwwen two is that, &lt;br /&gt;&lt;br /&gt;List.Update() creates automatically new version of list item as Update method is called. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;List.SystemUpdate() avoids SharePoint 2007 to change modified date and modifier fields. Argument false tells that no new versions are expected. &lt;br /&gt;&lt;br /&gt;SystemUpdate takes an boolean argument that set whether new version need to be created or not.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example using SystemUpdate() :&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;SPList list = web.Lists["myList"];&lt;br /&gt;SPListItem item = list.Items[0]; &lt;br /&gt;item["myField"] = "my value";&lt;br /&gt;&lt;br /&gt;item.SystemUpdate(false);&lt;br /&gt;list.Update();&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-8716900239870713828?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/8716900239870713828/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=8716900239870713828' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8716900239870713828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8716900239870713828'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/difference-between-update-and.html' title='Difference between Update and SystemUpdate in Sharepoint'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-5552363249267680986</id><published>2009-05-19T02:01:00.000-07:00</published><updated>2009-06-27T09:27:51.495-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Microsoft Office Sharepoint Authentication Explained</title><content type='html'>In order for people to use a MOSS web application, the web application must validate the person’s identity. This process is known as authentication. MOSS is not a directory service and the actual authentication process is handled by IIS, not MOSS. &lt;br /&gt;&lt;br /&gt;However, MOSS is responsible for authorization to MOSS sites and content after a user successfully authenticates. Authentication happens like this: A user points their browser at a MOSS site and IIS performs the user validation using the authentication method that is configured for the environment.&lt;br /&gt;&lt;br /&gt; If the user authentication is successful, then MOSS renders the web pages based on the access level of the user. If authentication fails, the user is denied access to the MOSS site. Authentication methods determine which type of identity directory can be used and how users are authenticated by IIS. MOSS supports three methods of authentication: Windows, ASP.NET Forms, and Web Single Sign-On.&lt;br /&gt;&lt;br /&gt;Windows Authentication is the most common authentication type used in MOSS intranet deployments because it uses Active Directory to validate users. When Windows Authentication is configured, IIS uses the Windows authentication protocol that is configured in IIS. NTLM, Kerberos, certificates, basic, and digest protocols are supported. When Windows authentication is configured, the security policies which are applied to the user accounts are configured within Active Directory. For example, account expiration policies, password complexity policies, and password history policies are all defined in Active Directory and not in MOSS. When a user attempts to authenticate to a MOSS web application using Windows authentication, IIS validates the user against NTFS and Active Directory, and once the validation occurs the user is authenticated and the access levels of that user are then applied by MOSS.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_AififblDFCg/ShJ12ufa1XI/AAAAAAAAA9Q/z03RlDj48n8/s1600-h/1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 298px; height: 400px;" src="http://1.bp.blogspot.com/_AififblDFCg/ShJ12ufa1XI/AAAAAAAAA9Q/z03RlDj48n8/s400/1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5337458091440657778" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Anonymous access is considered to be a Windows authentication method because it associates unknown users with an anonymous user account (IUSR_MACHINENAME). Anonymous access is commonly used in internet Web sites and in situations where web site users will not have their own user accounts. Since exposing content to unknown users is risky, this configuration is disabled by default. In order to configure anonymous access to a MOSS web application, anonymous access must be enabled in IIS, enabled in the MOSS web application, and the anonymous user account must be provisioned throughout the MOSS Web application. Even when anonymous access is configured, there are still several limitations compared to a Windows user. By default, anonymous users are only allowed to read, and they are unable to edit, update, or delete content. Additionally, anonymous users are not able to utilize personalization features such as Microsoft Office integration, check-in/check-out and email alerts. The ASP.NET Forms authentication method is commonly used in situations where a custom authentication provider is required. In other words, where a custom LDAP, SQL Server, or other type of identity repository will be storing user account information. This is common in extranet environments, such as partner collaboration sites, where it is not practical to create Active Directory user accounts for users or a different type of directory is required.&lt;br /&gt;&lt;br /&gt; The Web Single Sign-On authentication method is used in environments that have federated identity systems or single sign-on systems configured. In this type of environment, an independent identity management system integrates user identities across heterogeneous directories and provides the user validation for IIS. Some examples of identity management systems with single sign-on capability include Microsoft Identity Information Server with Active Directory Federation Services, Oracle Identity Management with Single Sign-On and Web Access Control, Sun Microsystems Java System Identity Manager, and Netegrity SiteMinder.&lt;br /&gt;&lt;br /&gt; Large enterprises often implement federated identity models to ease the administration of user provisioning and de-provisioning for systems that span across companies. Single Sign-On systems are used to consolidate user accounts across heterogeneous systems, allowing the end user to authenticate to systems with one set of credentials, rather than to use a different set of credentials for each unique system. In MOSS, it is possible to configure web applications to use a combination of authentication methods. This provides a great deal of flexibility because it makes it possible to serve a web application to different user bases which have different identity requirements. For example, an organization may have a Project Collaboration Web site that is used by employees and partners.&lt;br /&gt;&lt;br /&gt; For security and compliance reasons, it is necessary to store employee user accounts in Active Directory and partner user accounts in a SQL Server database. In this case, MOSS can be configured to use Windows authentication and ASP.NET Forms authentication. This is achieved by defining various zones and associated authentication methods to the zones. In the example above, an intranet zone would be configured with Windows authentication and an extranet zone would be configured with ASP.NET Forms authentication.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-5552363249267680986?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/5552363249267680986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=5552363249267680986' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/5552363249267680986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/5552363249267680986'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/microsoft-office-sharepoint.html' title='Microsoft Office Sharepoint Authentication Explained'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_AififblDFCg/ShJ12ufa1XI/AAAAAAAAA9Q/z03RlDj48n8/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-3082100535992726643</id><published>2009-05-19T02:00:00.000-07:00</published><updated>2009-05-19T02:01:31.430-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>MOSS Object Model : Sharepoint</title><content type='html'>Detailed MOSS Object Model&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_AififblDFCg/ShJ1XLH8fmI/AAAAAAAAA9I/SRtTW9iD1Yw/s1600-h/MOSS+Object+-+Model.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 383px;" src="http://1.bp.blogspot.com/_AififblDFCg/ShJ1XLH8fmI/AAAAAAAAA9I/SRtTW9iD1Yw/s400/MOSS+Object+-+Model.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5337457549371014754" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-3082100535992726643?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/3082100535992726643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=3082100535992726643' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/3082100535992726643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/3082100535992726643'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/moss-object-model-sharepoint.html' title='MOSS Object Model : Sharepoint'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_AififblDFCg/ShJ1XLH8fmI/AAAAAAAAA9I/SRtTW9iD1Yw/s72-c/MOSS+Object+-+Model.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-4560157407681672903</id><published>2009-05-18T21:11:00.000-07:00</published><updated>2009-05-18T21:18:28.356-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to cretae a new SPlist instance using the WSS object model</title><content type='html'>The following code provides the code to create a list instance. Before creating the list, the code checks to make sure a list of the same title doesn’t already exist. You will notice that the code enumerates through the lists within the current site, checking each list to see if there is a matching title. If a list with a matching title does not exist, the code in this application then creates a new instance of the Announcements list type and adds a link to the Quick Launch menu for easy access. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;using System;&lt;br /&gt;using Microsoft.SharePoint;&lt;br /&gt;&lt;br /&gt;class Program {&lt;br /&gt;  static void Main() {&lt;br /&gt;    using (SPSite site = new SPSite("http://localhost")) {&lt;br /&gt;      using (SPWeb web = site.OpenWeb()) {&lt;br /&gt;        string listName = "Litware News";&lt;br /&gt;        SPList list = null;&lt;br /&gt;        foreach (SPList currentList in web.Lists) {&lt;br /&gt;          if (currentList.Title.Equals(listName,&lt;br /&gt;                                       StringComparison.InvariantCultureIgnoreCase)) {&lt;br /&gt;            list = currentList;&lt;br /&gt;            break;&lt;br /&gt;          }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        if (list == null) {&lt;br /&gt;          Guid listID = web.Lists.Add(listName,&lt;br /&gt;                                      "List for big news items",&lt;br /&gt;                                      SPListTemplateType.Announcements);&lt;br /&gt;          list = web.Lists[listID];&lt;br /&gt;          list.OnQuickLaunch = true;&lt;br /&gt;          list.Update();&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The code shows how to create a SPLit of announcements. We can create any List type:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Document library &lt;br /&gt; Used for collaborating on documents with support for versioning, check-in and check-out, and workflow. Includes support for deep integration with Microsoft Office. &lt;br /&gt; &lt;br /&gt;Form library &lt;br /&gt; Used to store XML documents and forms for use with Microsoft Office InfoPath. &lt;br /&gt; &lt;br /&gt;Wiki page library &lt;br /&gt; Used for collaborative Web pages based on wiki pages, which are dynamically generated and collaboratively edited Web pages. &lt;br /&gt; &lt;br /&gt;Picture library &lt;br /&gt; A specialized document library enhanced for use with pictures. Includes support for slide shows, thumbnails, and simple editing through Microsoft Office Picture Manager. &lt;br /&gt; &lt;br /&gt;Announcements &lt;br /&gt; Used for simple sharing of timely news with support for expiration. &lt;br /&gt; &lt;br /&gt;Contacts &lt;br /&gt; A list for tracking people and contact information, with support for integration into Microsoft Office Outlook and other WSS-compatible contacts applications. &lt;br /&gt; &lt;br /&gt;Discussions &lt;br /&gt; A simple list for threaded discussions with support for approval and managing discussion threads. &lt;br /&gt; &lt;br /&gt;Links &lt;br /&gt; A list for managing hyperlinks. &lt;br /&gt; &lt;br /&gt;Calendar &lt;br /&gt; A list for tracking upcoming events and deadlines. Includes support for integration and synchronization with Office Outlook. &lt;br /&gt; &lt;br /&gt;Tasks &lt;br /&gt; A list of activity-based items that can integrate with workflow. &lt;br /&gt; &lt;br /&gt;Project tasks &lt;br /&gt; An enhanced tasks list with support for Gannt chart rendering and integration with Microsoft Office Project. &lt;br /&gt; &lt;br /&gt;Issue tracking &lt;br /&gt; A list for tracking issues and resolution, with support for prioritization. &lt;br /&gt; &lt;br /&gt;Custom list &lt;br /&gt; An empty list definition for extending with custom columns, or created using Microsoft Office Excel spreadsheets.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-4560157407681672903?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/4560157407681672903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=4560157407681672903' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4560157407681672903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4560157407681672903'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/how-to-cretae-new-splist-instance-using.html' title='How to cretae a new SPlist instance using the WSS object model'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-8923470863843965701</id><published>2009-05-18T02:31:00.000-07:00</published><updated>2009-06-27T09:33:03.200-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Workflow Foundation'/><title type='text'>what is Windows Workflow Foundation ?</title><content type='html'>The workflow functionality in Windows SharePoint Services 3.0 is built on the Windows Workflow Foundation (WF), a Microsoft Windows platform component that provides a programming infrastructure and tools for development and execution of workflow-based applications. WF simplifies the process of asynchronous programming to create stateful, long-running, and persistent workflow applications. The WF run-time engine manages workflow execution and allows workflows to remain active for long periods of time and to survive restarting the computer. Run-time services offer functionality such as transactions and persistence to manage errors gracefully and correctly.&lt;br /&gt;&lt;br /&gt;The WF run-time engine provides the services that every workflow application needs, such as sequencing, state management, tracking capabilities, and transaction support. The WF run-time engine serves as a state machine responsible for loading and unloading workflows, as well as managing the current state of any workflows that are running. WF allows any application process or service container to run workflows by hosting WF — that is, loading WF within its process.&lt;br /&gt;&lt;br /&gt;Windows SharePoint Services hosts the WF run-time engine. In place of the pluggable services that are included with WF, Windows SharePoint Services provides custom implementations of the following services for the engine: transaction, persistence, notifications, roles, tracking, and messaging. Developers can then create workflow solutions that run within Windows SharePoint Services.&lt;br /&gt;&lt;br /&gt;Figure 1 shows the workflow architecture in Windows SharePoint Services. Windows SharePoint Services hosts the WF run-time engine within its process, and provides custom implementations of the necessary services. The functionality of the WF run-time engine, as well as the hosting functionality Windows SharePoint Services provides, is exposed through the Windows SharePoint Services object model.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Figure 1. Workflow architecture in Windows SharePoint Services 3.0&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_AififblDFCg/ShErpHdc2LI/AAAAAAAAA8g/ZK01fqiDiq4/s1600-h/1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 360px;" src="http://4.bp.blogspot.com/_AififblDFCg/ShErpHdc2LI/AAAAAAAAA8g/ZK01fqiDiq4/s400/1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5337095018787952818" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-8923470863843965701?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/8923470863843965701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=8923470863843965701' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8923470863843965701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8923470863843965701'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/what-is-windows-workflow-foundation.html' title='what is Windows Workflow Foundation ?'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_AififblDFCg/ShErpHdc2LI/AAAAAAAAA8g/ZK01fqiDiq4/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-1091147740921113790</id><published>2009-05-16T23:52:00.001-07:00</published><updated>2009-05-16T23:52:40.195-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Foundation book on sharepoint 2007</title><content type='html'>There are two major books for begineers : &lt;br /&gt;&lt;br /&gt;1. Inside WSS 3.0 and 2. Inside MOSS 2007 from Mirosoft Press. &lt;br /&gt;&lt;br /&gt;These two books will give a strong foundation to the new bie in sharepoint&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-1091147740921113790?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/1091147740921113790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=1091147740921113790' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1091147740921113790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1091147740921113790'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/foundation-book-on-sharepoint-2007.html' title='Foundation book on sharepoint 2007'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-2074561919327367211</id><published>2009-05-14T06:01:00.000-07:00</published><updated>2009-06-30T06:58:40.636-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to get distinct value from CAML query</title><content type='html'>Many times, we face a challenge to get unique rows froma CAML query. The main problem is that CAML does not have any feature to get the distinct rows in one go.&lt;br /&gt;&lt;br /&gt;Way Around:&lt;br /&gt;&lt;br /&gt;We all know that CAML query returns SPListItemCollection and we can convert the outcome to data table also.&lt;br /&gt;We can convert the resultant datatable to dataview and again convert the dataview to datatable by using ToTable and arguments :&lt;br /&gt;Distinct = true&lt;br /&gt;and column name&lt;br /&gt;&lt;br /&gt;So.. &lt;br /&gt;suppose we have SPWeb object as 'web' so&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;DataTable DT= web.GetSiteData(qry);&lt;br /&gt;DataView v = new DataView(tbl);&lt;br /&gt;return v.ToTable(true, "Type");&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This code snippets returns the distinct rows by comparing column name "Type".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-2074561919327367211?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/2074561919327367211/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=2074561919327367211' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2074561919327367211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2074561919327367211'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/05/how-to-get-distinct-value-from-caml.html' title='How to get distinct value from CAML query'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-4091989900076312376</id><published>2009-04-27T22:27:00.000-07:00</published><updated>2009-04-27T22:34:05.060-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to check whether SPList exists in Sharepoint?</title><content type='html'>Sometimes we require to check whether SPList exists or not. There is no direct method to check for it. Instead we have to use try-catch block to catch the exception and to determine the list existence:&lt;br /&gt;&lt;br /&gt;The code is:&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;using (SPSite ospSite = new SPSite("http://&amp;LT;servername&amp;GT;:&amp;LT;portname&amp;GT;"))&lt;br /&gt;{&lt;br /&gt;using (SPWeb ospWeb = ospSite.OpenWeb())&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;SPList ospList = ospWeb.Lists["ListName"];&lt;br /&gt;if (ospList != null)&lt;br /&gt;return true;&lt;br /&gt;}&lt;br /&gt;catch(Exception ex)&lt;br /&gt;{&lt;br /&gt;return false;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;This code block creates an instance of SPList object. If ospList object is not null that is list is there so it returns true.&lt;br /&gt;If list does not exists, an exception will be raised and false will be returned from catch block&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-4091989900076312376?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/4091989900076312376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=4091989900076312376' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4091989900076312376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4091989900076312376'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/04/how-to-check-whether-splist-exists-in.html' title='How to check whether SPList exists in Sharepoint?'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-1059762510506045604</id><published>2009-04-21T22:38:00.000-07:00</published><updated>2009-06-27T09:32:05.973-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Using SPPropertybag to save value</title><content type='html'>Hi,&lt;br /&gt;this small code snippet will explain how to store value to Sharepoint proerty bag and how to fetch it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#000099;"&gt;How to save value to SPProperty Bag&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Here we will create an instanceof SPPropertyBag and try to add a key 'BlogImage' to the bag:&lt;br /&gt;&lt;br /&gt;SPPropertyBag spProperties = SPContext.Current.Web.Properties;&lt;br /&gt;if (spProperties.ContainsKey("BlogImage")) spProperties.Remove("BlogImage");&lt;br /&gt;spProperties.Add("BlogImage", path);&lt;br /&gt;spProperties.Update();&lt;br /&gt;SPContext.Current.Web.Update();&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#cc0000;"&gt;&lt;strong&gt;NOTE:&lt;/strong&gt;&lt;/span&gt; Updating SPPropertybag and SPWeb is important.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#000099;"&gt;How to get value from SPProperty Bag&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;SPPropertyBag spProperties = ospWeb.Properties;&lt;br /&gt;string blogImageValue=string.Empty;&lt;br /&gt;if (spProperties["BlogImage"] != null &amp;amp;&amp;amp; spProperties["BlogImage"] != "")      &lt;br /&gt; {&lt;br /&gt;blogImageValue= spProperties["BlogImage"].Trim();           &lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-1059762510506045604?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/1059762510506045604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=1059762510506045604' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1059762510506045604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1059762510506045604'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/04/using-spproperty-bag-to-save-value.html' title='Using SPPropertybag to save value'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-9032624917137671249</id><published>2009-04-15T23:16:00.000-07:00</published><updated>2009-04-15T23:30:52.241-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to set People Picker value in Sharepoint</title><content type='html'>We all are aware of peoplepicker control.&lt;br /&gt;Today we will discuss how to set its value from code and how to retrieve it.&lt;br /&gt;&lt;br /&gt;Suppose we have a peoplepicker control named: &lt;strong&gt;pplowner&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;Setting Value to PeoplePicker from code:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;pplOwner.CommaSeparatedAccounts = "EUNET\USERNAME";&lt;br /&gt;&lt;br /&gt;If you wish to put the current logged in user name in peoplepicker, you can use:&lt;br /&gt;&lt;br /&gt;pplOwner.CommaSeparatedAccounts =SPContext.Current.Web.CurrentUser.LoginName;&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;Fetching Value of PeoplePicker from code:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;if (pplOwner.Accounts.Count &amp;GT; 0)&lt;br /&gt;string userid= pplOwner.Accounts[0].ToString();&lt;br /&gt;&lt;br /&gt;You can also iterate the usernames in peoplepicker as;&lt;br /&gt;&lt;br /&gt;for (int i=0; i&amp;LT;pplowner.Accounts.Count;i++)&lt;br /&gt; Console.Writeline( pplOwner.Accounts[i].ToString);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-9032624917137671249?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/9032624917137671249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=9032624917137671249' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/9032624917137671249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/9032624917137671249'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/04/how-to-set-people-picker-value-in.html' title='How to set People Picker value in Sharepoint'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-3763535767921294986</id><published>2009-04-15T23:06:00.001-07:00</published><updated>2009-06-10T22:44:40.828-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to get current login SPUSer in sharepoint</title><content type='html'>Many times we require to get the logged in user in sharepoint.&lt;br /&gt;We can easily get the SPUser object of the current logged in user:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SPUser user=SPContext.Current.Web.CurrentUser;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This will give the current logged in user. Now you can get user's email, groupName, Name from various properties like:&lt;br /&gt;user.LoginName, user.Email etc&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-3763535767921294986?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/3763535767921294986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=3763535767921294986' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/3763535767921294986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/3763535767921294986'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/04/how-to-get-current-login-spuser-in.html' title='How to get current login SPUSer in sharepoint'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-1057037859933430742</id><published>2009-04-15T22:16:00.000-07:00</published><updated>2009-06-27T09:31:56.457-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to open SPSite, SPWeb in ASP.NET</title><content type='html'>&lt;span style="font-family:georgia;"&gt;This small article will describe , how to open SPSite and SPWeb from asp.net application and how to dispose it properly.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;Since we are required to open a sharepoint object, so we need to refer Microsoft.Sharepoint.dll.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;The location of the dll is: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;&lt;strong&gt;Step 1.&lt;/strong&gt; : Refer the above dll and add the namespace:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;using Microsoft.Sharepoint; //C# code written&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;SPSite is an object to create an instance of a Sharepoint Site &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;SPWeb is an object to create an instance of a Sharepoint Web.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;using (SPSite ospSite=new SPSite ("&lt;/span&gt;&lt;a href="http://servername:portname"&gt;&lt;span style="font-family:georgia;"&gt;http://servername:portname&lt;/span&gt;&lt;/a&gt;"&lt;span style="font-family:georgia;"&gt;))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;using (SPWeb ospWeb=ospSite.openWeb())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;{&lt;/span&gt;&lt;br /&gt;//At this point you can perform any operation on ospWeb and ospSite.&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;&lt;/span&gt;&lt;br /&gt;Here, I have used &lt;strong&gt;using &lt;/strong&gt;to open an instance of SPSite/SPWeb object because this automatically dispose the object as the scope ends.&lt;br /&gt;You don't required to close and dispose it again.&lt;br /&gt;For more detials, check the following link:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://firstblogofvarun.blogspot.com/2009/03/disposing-spweb-and-spsite-objects.html"&gt;http://firstblogofvarun.blogspot.com/2009/03/disposing-spweb-and-spsite-objects.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-1057037859933430742?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/1057037859933430742/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=1057037859933430742' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1057037859933430742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1057037859933430742'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/04/how-to-open-spsite-spweb-in-aspnet.html' title='How to open SPSite, SPWeb in ASP.NET'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-8751659525595386650</id><published>2009-04-10T00:16:00.000-07:00</published><updated>2009-04-10T00:22:07.646-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.Net'/><title type='text'>ASP.NET from Scratch - Code Behind - Part III</title><content type='html'>While our first example was fine, we unfortunately broke one of the coding principles of ASP.NET: &lt;strong&gt;To separate markup and code.&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;As you noticed, we added a scripting block (using &amp;LT;% %&amp;GT;), where we wrote a line of C# code to use the label. While this is just fine for a small and simple example like this, we would soon get a real mess with a bunch of C# code within an even bigger amount of HTML code. &lt;br /&gt;&lt;br /&gt;If you throw in some JavaScript and some CSS as well, it will soon become very chaotic to edit. That's why MS introduced CodeBehind, a technique which allows you to completely separate markup (HTML, CSS etc.) and code (C#, VB.NET etc.). So let's remove the script block (from &amp;LT;% to %&amp;GT;) and save the file. &lt;br /&gt;&lt;br /&gt;As we talked about earlier, VWD added a file called Default.aspx.cs. If you can't see it in the Solution Explorer, then click the little plus sign left of the Default.aspx file. Open this file. Now, if you haven't worked with .NET or another non-web programming language before, it might look a bit scary at this point. It looks nothing like HTML. However, I will try to explain the different parts of the content, and soon you will hopefully see that CodeBehind is a great tool to get a better overview of your work. &lt;br /&gt;&lt;br /&gt;Here is a complete listing of the file as it looks right now: &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;&lt;br /&gt;public partial class _Default : System.Web.UI.Page &lt;br /&gt;{&lt;br /&gt;    protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;For now, the top part is rather irrelevant to us. It's a list of namespaces being included with the using keyword, for usage in the file. Since this is an ASP.NET tutorial and not a dedicated C# tutorial, I won't explain this in depth out here. I will post a separate post for this topic. &lt;br /&gt;&lt;br /&gt;Next, we have the class. Classes are a part of the concept of Object Oriented programming, which has become very popular, especially with languages like Java and C#. OO is a very complex subject, which also won't be explained within this tutorial. &lt;br /&gt;The name of this class is "_Default", and the : (colon) tells us that this class inherits from the Page class in the System.Web.UI namespace. This means that our page can already do a bunch of things, without any programming, because it inherits methods and properties from another class. &lt;br /&gt;&lt;br /&gt;All ASP.NET pages &lt;strong&gt;inherits from the Page class&lt;/strong&gt;, or another class which inherits from the Page class. &lt;br /&gt;&lt;br /&gt;The only method within this class is the &lt;strong&gt;Page_Load&lt;/strong&gt;, which is called everytime the page is loaded. Let's use that to our advantage, and set the ext from this method. We can use the exact same line of code as before, but of course without the script block tags. Add the line of code between the { and } characters: &lt;br /&gt;&lt;br /&gt;HelloWorldLabel.Text = "Hello, world!";&lt;br /&gt;&lt;br /&gt;That's it. Run the project (F6), and have a look. The page looks exactly like before, but we have just used CodeBehind for the first time. But this example is starting to get a bit old, so in the next chapter, we will look into something a bit more interesting.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-8751659525595386650?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/8751659525595386650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=8751659525595386650' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8751659525595386650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8751659525595386650'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/04/aspnet-from-scratch-code-behind-part.html' title='ASP.NET from Scratch - Code Behind - Part III'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-4430489579094313924</id><published>2009-04-10T00:08:00.000-07:00</published><updated>2009-04-10T00:14:42.850-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.Net'/><title type='text'>ASP.NET From Scratch - 1st Program - Part II</title><content type='html'>With MS Visual Web Developer installed, we're ready to create our first ASP.NET website. In VWD, this is very easy. Open the File menu and select "New Web Site". You will be presented with the following dialog: &lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_AififblDFCg/Sd7wplzvHeI/AAAAAAAAA8I/B0JDicoWHAY/s1600-h/1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 264px;" src="http://2.bp.blogspot.com/_AififblDFCg/Sd7wplzvHeI/AAAAAAAAA8I/B0JDicoWHAY/s400/1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5322956406912916962" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You need to select "ASP.NET Web Site", if it's not already selected. You should also name your new site. This is done by entering a name in the Location box. This text box is probably already filled for you, with the last part being something like "Website1". You can choose to accept this, as well as the location of the project, or you can enter a new one, like I did. I have created a folder, "My Websites", and within this folder, I would like to create the new project with the name of "FirstWebSite". For now, this is less important, but later on you might wish to gather all your projects in a specific folder. &lt;br /&gt;&lt;br /&gt;This tutorial will focus on the C# language. Once again, no knowledge of this is required, so if you already know another .NET language, you will get to learn some C# with this tutorial as well. Select C# in the Language dropdown. Now, click the Ok button to create this new website. &lt;br /&gt;&lt;br /&gt;VWD will create a very basic website for you, consisting only of a Default.aspx file (and it's partner, the Default.aspx.cs file) and an App_Data folder. I will explain this later, but for now, just accept the fact that they are there. We will only use the Default.aspx for this first example. Move on to the next chapter, for the obligatory "Hello, world!" example.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Hello World &lt;/strong&gt; Program&lt;br /&gt;&lt;br /&gt;In almost every programming tutorial you will find the classic "Hello, world!" example, and who am I to break such a fine tradition? Let me show you how you can say hello to the world from ASP.NET. Open the Default.aspx (if it's not already opened) by doubleclicking it in the Solution Explorer. It already contains a bunch of (X)HTML markup, as well as some stuff you probably won't recognize, like the Page directive in the top, or the runat attribute on the form tag. This will all be explained later, but for now, we want to see some working code. &lt;br /&gt;&lt;br /&gt;First of all, we will add a Label control to the page. &lt;br /&gt;A Label control is some what simple, since it's just used to hold a piece of text. Add the following piece of HTML-looking code somewhere between the set of &amp;LT;form&amp;GT; tags: &lt;br /&gt;&lt;br /&gt;&lt;b&gt;&amp;LT;asp:Label runat="server" id="HelloWorldLabel"&amp;GT;&amp;LT;/asp:Label&amp;GT;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Secondly, add this script block somewhere on the page, preferably below the Page directive in the top: &lt;br /&gt;&lt;b&gt;&lt;br /&gt;&amp;LT;%&lt;br /&gt;    HelloWorldLabel.Text = "Hello, world!";&lt;br /&gt;%&amp;GT;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you haven't worked with ASP.NET before, I'm sure there's a bunch of things that you're wondering about now, but as I said, this is all about seeing some results right now.&lt;br /&gt;To see the page in action, use &lt;b&gt;Debug -&amp;GT; Start Without Debugging&lt;/b&gt;, or simply press F6. VWD will now compile your project, and launch the page you're working on in your default browser. The page will simply have a piece of text which says "Hello, world!" - congratulations, you have just created your first ASP.NET website! &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Here is the complete listing: &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;LT;%&lt;br /&gt;    HelloWorldLabel.Text = "Hello, world!";&lt;br /&gt;%&amp;GT;&lt;br /&gt;&amp;LT;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;GT;&lt;br /&gt;&amp;LT;html xmlns="http://www.w3.org/1999/xhtml" &amp;GT;&lt;br /&gt;&amp;LT;head runat="server"&amp;GT;&lt;br /&gt;    &amp;LT;title&amp;GT;Untitled Page&amp;LT;/title&amp;GT;&lt;br /&gt;&amp;LT;/head&amp;GT;&lt;br /&gt;&amp;LT;body&amp;GT;&lt;br /&gt;    &amp;LT;form id="form1" runat="server"&amp;GT;&lt;br /&gt;    &amp;LT;div&amp;GT;&lt;br /&gt;        &amp;LT;asp:Label runat="server" id="HelloWorldLabel"&amp;GT;&amp;LT;/asp:Label&amp;GT;&lt;br /&gt;    &amp;LT;/div&amp;GT;&lt;br /&gt;    &amp;LT;/form&amp;GT;&lt;br /&gt;&amp;LT;/body&amp;GT;&lt;br /&gt;&amp;LT;/html&amp;GT;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-4430489579094313924?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/4430489579094313924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=4430489579094313924' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4430489579094313924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4430489579094313924'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/04/aspnet-from-scratch-1st-program-part-ii.html' title='ASP.NET From Scratch - 1st Program - Part II'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_AififblDFCg/Sd7wplzvHeI/AAAAAAAAA8I/B0JDicoWHAY/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-6692550634876063061</id><published>2009-04-10T00:03:00.000-07:00</published><updated>2009-04-10T00:07:18.712-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.Net'/><title type='text'>ASP.NET From Scratch - Introduction - Part I</title><content type='html'>Welcome to this ASP.NET tutorial. According to Microsoft, "ASP.NET is a technology for building powerful, dynamic Web applications and is part of the .NET Framework". This tutorial will teach you ASP.NET from scratch, and no knowledge of any kind of server side scripting is required. Basic HTML and CSS knowledge is preferable. Having worked with Classic ASP or PHP won't give you much of an advantage, since ASP.NET is a whole new way of doing things. &lt;br /&gt;&lt;br /&gt;.NET is language independent, which means you can use any .NET supported language to make .NET applications. The most common languages for writing ASP.NET applications are C# and VB.NET. While VB.NET is directly based VB (Visual Basic), C# was introduced together with the .NET framework, and is therefore a some what new language. Some people call C# "the .NET language", but according to Microsoft, you can do all the same things, no matter if you're using C# or VB.NET. The 2 languages are not that different, and if you have used one of them, you will have no problems at all learning the other. In this tutorial we will use C#. &lt;br /&gt;&lt;br /&gt;One of the main differences between ASP.NET and Classic ASP/PHP is the fact that ASP.NET is compiled, while Classic ASP is always interpreted. PHP can be compiled by using commercial products, but usually it's interpreted as well. &lt;br /&gt;&lt;br /&gt;This tutorial will use the free Visual Web Developer 2005 IDE from Microsoft. Despite what some people think, ASP.NET can be used without an IDE. It would be perfectly possible to write ASP.NET code in Notepad, and use the commandline compiler included with the .NET framework. Some people might actually prefer this "back to basics" way of doing things, but I believe that ASP.NET is best programmed with a decent IDE. You can use an IDE from another vendor, and you will still be able to follow most of this tutorial. We will use VWD 2005 since it's free, quick to install and easy to use. Besides, using a good IDE will make a lot of things faster in the long run. &lt;br /&gt;&lt;br /&gt;Now, you can read more about VWD 2005 on this page:&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/vstudio/express/vwd/"&gt;http://msdn.microsoft.com/vstudio/express/vwd/&lt;/a&gt; and download it from this page: &lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/vstudio/express/vwd/download/"&gt;Download&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;. The initial download is very small, because the installation is based on which components you already have and which will have to be downloaded. Just execute the file, and you will be guided through the installation. Once installed, start up the application, and proceed to the next chapter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-6692550634876063061?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/6692550634876063061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=6692550634876063061' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6692550634876063061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6692550634876063061'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/04/aspnet-from-scratch-introduction-part-i.html' title='ASP.NET From Scratch - Introduction - Part I'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-2135181073270362396</id><published>2009-04-09T23:54:00.000-07:00</published><updated>2009-06-27T09:31:46.767-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Common'/><title type='text'>How Google Interpret your query</title><content type='html'>This article describes how Google treats your search terms.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;All Search Terms Count&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Google returns only pages that match all your search terms.&lt;br /&gt;&lt;br /&gt;For example a search for PR PLAN 2009 find pages containing the words “PR” and “PLAN” and “2009”.&lt;br /&gt;&lt;br /&gt;This means Google adds implicit AND to the search query terms.&lt;br /&gt;&lt;br /&gt;NOTE: Google sometimes returns pages that does not contains your query terms because Google returns pages in which your query terms are included in the link text to another page or place on the page.&lt;br /&gt;&lt;br /&gt;Google also searches the metadata values set for a page (if any) with the query terms and if match found, the page is returned in search result.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Search Terms Match Exactly&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Google returns pages that match your search terms exactly.&lt;br /&gt;&lt;br /&gt;That means that Google simply matches string of characters together by putting and in between. It does not look for synonyms of words.&lt;br /&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;If you search for …&lt;/td&gt;&lt;td&gt;Google won't find …&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;cheap &lt;/td&gt;&lt;td&gt;inexpensive&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;tv&lt;/td&gt;&lt;td&gt;television&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;effects &lt;/td&gt;&lt;td&gt;influences&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;children &lt;/td&gt;&lt;td&gt;kids&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Stop Words&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Some common words such as ‘the’, ‘a’, ‘an’, ‘on’, ‘where’, ‘this’, ‘is’, ‘when’ generally don’t add meaning to a search and are called Stop Words.&lt;br /&gt;&lt;br /&gt; These words are omitted while performing the search.&lt;br /&gt;&lt;br /&gt;For example if you search for ‘What to do for a student visa’, Google searches for terms ‘to’, ‘do’, ‘student’ and ‘visa’ ignoring ‘What’, ‘for’ , ‘a’.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_AififblDFCg/Sd7t-A5zS9I/AAAAAAAAA8A/anbvigVFWMU/s1600-h/1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 57px;" src="http://4.bp.blogspot.com/_AififblDFCg/Sd7t-A5zS9I/AAAAAAAAA8A/anbvigVFWMU/s400/1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5322953459248614354" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Terms in Order&lt;/strong&gt;&lt;br /&gt;Google gives higher priority to pages that have the terms in the same order as in your query.&lt;br /&gt;&lt;br /&gt;Consequently, you should enter search terms in the order in which you would expect to find them on the pages you're seeking. A search for [Microsoft latest technologies] gives priority to pages about Microsoft’s Latest Technologies. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Not Case-Sensitive&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Google is not case-sensitive. It shows both upper- and lowercase results.&lt;br /&gt;Ignoring case distinctions increases the number of results Google finds. A search for “Times Square” finds pages containing “Times Square”, “times square” or “TIMES Square”&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Characters Ignored&lt;/strong&gt;&lt;br /&gt; Google ignores some punctuation and special characters, including &lt;br /&gt;&lt;br /&gt;! ? , . ; [ ] @ / # &lt; &gt; .&lt;br /&gt;&lt;br /&gt; For example Dr. Watson returns the same values as Dr Watson&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Apostrophes&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt; A term with an apostrophe doesn’t match the term without an apostrophe.&lt;br /&gt;&lt;br /&gt; For example, ‘we’er’ matches “we’er” but not “were” and vice versa.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Quoted Phrases&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To search for a phrase, a proper name, or a set of words in a specific order, put them in double quotes.&lt;br /&gt;&lt;br /&gt;A query with terms in quotes finds pages containing the exact quoted phrase.&lt;br /&gt;&lt;br /&gt;For example, search term “White House” finds pages containing the phrase “White House” exactly.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; If you put stop words in between double quotes, Google will search for the phrase including those stop words.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-2135181073270362396?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/2135181073270362396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=2135181073270362396' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2135181073270362396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2135181073270362396'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/04/how-google-interpret-your-query.html' title='How Google Interpret your query'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_AififblDFCg/Sd7t-A5zS9I/AAAAAAAAA8A/anbvigVFWMU/s72-c/1.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-7708306023970894465</id><published>2009-03-23T22:17:00.000-07:00</published><updated>2009-06-27T09:31:12.189-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to use resource file in Sharepoint</title><content type='html'>Today I will tell you how to use resource file in sharepoint.&lt;br /&gt;&lt;br /&gt;Resource file is stored in location '12/Resources' directory.&lt;br /&gt;&lt;br /&gt;If you don't know where this '12' folder exists , then the full path is:&lt;br /&gt;&lt;br /&gt;C:\Program Files\Common Files\Microsoft Shared\web server extensions\12&lt;br /&gt;&lt;br /&gt;There you will see a folder named 'Rescources'.&lt;br /&gt;&lt;br /&gt;Suppose we have a resource file named &lt;b&gt;CustomResource.resx&lt;/b&gt; with a key/value pair as :&lt;br /&gt;&lt;br /&gt;&lt;b&gt;userName&lt;/b&gt; : TestUser&lt;br /&gt;&lt;br /&gt;Now, if we need to access the value of key &lt;b&gt;userName&lt;/b&gt; from resource file from our application, we need to do:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;string srcName = SPUtility.GetLocalizedString(&lt;br /&gt;"$Resources:CustomResource,userName", "CustomResource", 1033);&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;You can also use the above code like this also:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;string srcName = SPUtility.GetLocalizedString(&lt;br /&gt;"$Resources:userName", "CustomResource", 1033);&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;Varun Sharma&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-7708306023970894465?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/7708306023970894465/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=7708306023970894465' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7708306023970894465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7708306023970894465'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/03/how-to-use-resource-file-in-sharepoint.html' title='How to use resource file in Sharepoint'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-3138148540908964228</id><published>2009-03-18T23:59:00.001-07:00</published><updated>2009-06-27T09:30:55.346-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Sometimes, I set breakpoints and attach to the process but Visual Studio skips loading the symbols if I’m debugging a deployed assembly to the GAC and</title><content type='html'>Easy, Open Tools -&gt; Options -&gt;  Debugging.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_AififblDFCg/ScHteDChKRI/AAAAAAAAA64/V6VFlpbDxiI/s1600-h/spmag10.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 238px;" src="http://1.bp.blogspot.com/_AififblDFCg/ScHteDChKRI/AAAAAAAAA64/V6VFlpbDxiI/s400/spmag10.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5314790135741622546" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You’ll find an option labeled Enable Just My Code (Managed Only) as shown in the figure which is checked by default. Uncheck this option to be able to debug the assemblies located in the GAC. There is a common myth among .NET developers in general and especially SharePoint ones, that in order to debug assemblies that have been deployed to the GAC, you need to copy the debug symbols (PDB File) to the GAC as well. This was true in the early days of .NET but this is no longer true.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-3138148540908964228?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/3138148540908964228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=3138148540908964228' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/3138148540908964228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/3138148540908964228'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/03/sometimes-i-set-breakpoints-and-attach.html' title='Sometimes, I set breakpoints and attach to the process but Visual Studio skips loading the symbols if I’m debugging a deployed assembly to the GAC and'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_AififblDFCg/ScHteDChKRI/AAAAAAAAA64/V6VFlpbDxiI/s72-c/spmag10.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-602361888728729</id><published>2009-03-18T23:57:00.000-07:00</published><updated>2009-03-18T23:58:51.584-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>When I try to attach the debugger to the W3WP.exe process to debug, I always see multiple instances of it. Which one should I attach to?</title><content type='html'>Ok, this is easy too. Just follow the following steps.&lt;br /&gt;&lt;br /&gt;Open the command prompt window, run IISAPP to get a list of the current instances of W3WP.exe. &lt;br /&gt;&lt;br /&gt;Note the PID of the instance that corresponds to your web application. &lt;br /&gt;&lt;br /&gt;Now return to VS, select Debug -&gt; Attach to process and attach to the W3wp.exe instance with an ID equivalent to the PID you got in step 2 -&gt; click Attach. &lt;br /&gt;&lt;br /&gt;Now you can trace through the code and find the error causes easily. &lt;br /&gt;&lt;br /&gt;But the question still remains, why sometimes are they more than one w3wp.exe instance? This is because the SharePoint Administration Site Collection and the SSP Administration site always have their own Application pools for error isolation purposes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-602361888728729?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/602361888728729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=602361888728729' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/602361888728729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/602361888728729'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/03/when-i-try-to-attach-debugger-to.html' title='When I try to attach the debugger to the W3WP.exe process to debug, I always see multiple instances of it. Which one should I attach to?'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-1060194963154695031</id><published>2009-03-18T23:50:00.000-07:00</published><updated>2009-03-18T23:57:12.490-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to get detailed error message in Sharepoint site</title><content type='html'>SharePoint uses a user friendly (Yellow &amp; Blue) error page to show that a problem occurred. Yeah, they call it the user friendly page, but we, as developers, call it the Annoying Page. The first time I wrote SharePoint code, I received a screen like the one shown in the figure below:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_AififblDFCg/ScHrq5Rak0I/AAAAAAAAA6o/w6W0Ay2ha2w/s1600-h/spmag13.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 154px;" src="http://1.bp.blogspot.com/_AififblDFCg/ScHrq5Rak0I/AAAAAAAAA6o/w6W0Ay2ha2w/s400/spmag13.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5314788157434794818" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This error page points out that an assembly has thrown an unhandled System.Exception. Sometimes, the user-friendly error page will specify the nature of the error if the code that threw the exception used something more specific than System.Exception or if it included a message in the Exception class constructor.&lt;br /&gt;&lt;br /&gt;We need to get a more detailed Error Message than the annoying “Unexpected error has occurred “. This can be achieved by doing three modifications to the Web.Config file from the virtual directory containing your SharePoint application. These modifications are listed in the next table.&lt;br /&gt;&lt;br /&gt;Tag&lt;br /&gt;   customErrors  Mode :Off or Remote only&lt;br /&gt;   SafeMode CallStack : True&lt;br /&gt;   SafeMode AllowPageLevelTrace: True&lt;br /&gt; &lt;br /&gt;No Custom Errors shows the full error to every client, every time. This is typically used Development environment, since there are no clients using it.&lt;br /&gt;&lt;br /&gt;I recommend using the Debug Config feature to automate this process. This is just a feature that when you activate on a web application, it automatically tweaks the Web.Config of the specified web application across the farm.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-1060194963154695031?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/1060194963154695031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=1060194963154695031' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1060194963154695031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1060194963154695031'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/03/how-to-get-detailed-error-message-in.html' title='How to get detailed error message in Sharepoint site'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_AififblDFCg/ScHrq5Rak0I/AAAAAAAAA6o/w6W0Ay2ha2w/s72-c/spmag13.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-5458195164077161928</id><published>2009-03-17T02:14:00.000-07:00</published><updated>2009-06-27T09:30:22.270-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net Framework 3.5'/><title type='text'>.NET NameValueCollection DataTypes</title><content type='html'>A NameValueCollection is similar to a .NET Hash Table in that it can store items in key/value pairs and allows you to retrieve items by specifying either the Key or index. In fact, NameValueCollections use the hash table and hash table algorithms for their underlying data structures. &lt;br /&gt;&lt;br /&gt;Unlike a hash table that can store any type of object as its key or value, NameValueCollections can only store string values. However, a NameValueCollection can store multiple strings values for each key. Because NameValueCollections use the hash table algorithms, they are slower performance wise than hash tables. &lt;br /&gt;&lt;br /&gt;A NameValueCollection also has methods to return a collection of all keys, all values, add and remove items and to get an enumerator so you can enumerate through the collection.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-5458195164077161928?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/5458195164077161928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=5458195164077161928' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/5458195164077161928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/5458195164077161928'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/03/net-namevaluecollection-datatypes.html' title='.NET NameValueCollection DataTypes'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-2216607300063941493</id><published>2009-03-13T05:01:00.000-07:00</published><updated>2009-03-13T05:02:36.381-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.Net'/><title type='text'>How to change default button of ASP.NET Page</title><content type='html'>ASP.Net 2.0 has a new feature of setting default button of a asp.net page.&lt;br /&gt; Now you can set initial focus on your form and also set a default button (for when pressing enter) by setting 2 attributes on your form tag: &lt;br /&gt;&lt;br /&gt;defaultbutton="Button1" defaultfocus="TextBox1"&lt;br /&gt;&lt;br /&gt;This will add JavaScript to set focus on TextBox1 and set the Button1 as the default button for when a user presses enter on the web form. &lt;br /&gt;&lt;br /&gt;This is very neat, but when using master pages you don't have access to the form tag. As of any property, you can also set it at the code behind, but you need a little trick. Since ASP.NET uses javascript to set the focus and the default button, you have to specify the client id of the controls, rather than the server ids:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Page.Form.DefaultButton = Button1.UniqueID;&lt;br /&gt;Page.Form.DefaultFocus = TextBox1.ClientID;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Happy Programming!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-2216607300063941493?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/2216607300063941493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=2216607300063941493' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2216607300063941493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2216607300063941493'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/03/how-to-change-default-button-of-aspnet.html' title='How to change default button of ASP.NET Page'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-4460995933359433149</id><published>2009-03-12T22:17:00.001-07:00</published><updated>2009-05-20T02:20:42.799-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to get SPUser name from User Id</title><content type='html'>Sometimes we get uniques user id from sharepoint but the requirement is for name.&lt;br /&gt;&lt;br /&gt;This can be done in one simple line:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt; using (SPSite site=new SPSite(siteurl))&lt;br /&gt; {&lt;br /&gt;  using (SPWeb web=site.OpenWeb())&lt;br /&gt; {&lt;br /&gt;   &lt;b&gt;string userName= web.AllUsers.GetByID(Convert.ToInt32(userid)).Name;&lt;/b&gt;&lt;br /&gt; }&lt;br /&gt; }&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Line number 5 actually gets the user name by searching all users in the 'web' scope by searching userId.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-4460995933359433149?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/4460995933359433149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=4460995933359433149' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4460995933359433149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4460995933359433149'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/03/how-to-get-spuser-name-from-user-id.html' title='How to get SPUser name from User Id'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-4375215411080862824</id><published>2009-03-11T22:26:00.000-07:00</published><updated>2009-06-27T09:30:02.409-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Disposing SPWeb and SPSite objects</title><content type='html'>&lt;strong&gt;What happens if a SPWeb object is not disposed?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Each SPWeb and SPSite object holds a reference to a SPRequest object which holds a reference to a SharePoint COM object that is responsible to communicate with the backend SQL server. &lt;br /&gt;&lt;br /&gt;Disposing a SPWeb object will not actually remove the SPWeb object from memory (actually the .NET framework does not allow to remove any object from memory in a deterministic way) but it will call a method of the SPWeb object which causes the COM object to close the connection to the SQL server and to release its allocated memory. &lt;br /&gt;&lt;br /&gt;That means the connection to the backend SQL server will remain open from the moment the SPRequest object has been created till the SPWeb object is disposed.&lt;br /&gt;After the dispose only the small managed SPWeb and SPRequest objects remain in memory which do not create a big memory overhead. They are removed by the dot net framework through garbage collection later as with any other managed object as soon as no references to the object exist any more.&lt;br /&gt;&lt;br /&gt;In case that the SPWeb object is not disposed when it is no longer used, then the connection to the SQL server will stay open and the memory allocated by the COM object will stay in memory as the COM object has not been asked to close the connection and to release the memory.&lt;br /&gt;&lt;br /&gt;Each connection to the database requires a tcp port for the communication. Per default only 5000-1023 = 3977 ports are available. Which means on a single machine per default you cannot have more than 3977 open connections to other applications. Be aware that this is the number for all processes. Not just a single application pool.&lt;br /&gt;&lt;br /&gt;So beside the fact that not disposing SPWeb and SPSite will lead to a higher memory consumption which finally can lead to out of memory exceptions the machine might also run out of TCP ports which would lead to lots of other problems - potentially also in other applications on the same server.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;When should SPWeb and SPSite objects be disposed?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;You should dispose a SPWeb or SPSite object after the last access to a child object of this object. Be aware that a sub site (SPWeb) is not a child object. But (e.g.) a list or a folder or list item is a child object for this scenario.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;When should I dispose SPSite.RootWeb?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;When SPSite.RootWeb is first accessed it creates an SPWeb object using SPSite.OpenWeb and stores a reference in an internal variable. Further accesses to SPSite.RootWeb are then satisfied by returning a reference to the earlier created object. In case the RootWeb object has been disposed it will create a new one using OpenWeb as for the initial access.&lt;br /&gt;&lt;br /&gt;That means we have a single SPWeb object per SPSite object even if we access SPSite.RootWeb multiple times. Creating a SPWeb object is an expensive operation as it requires the instantiation of a COM object, a database communication to download the info about the SPWeb object and so on. That means disposing the RootWeb object after every single access to it can affect the performance of the site - especially if you have many different places in your project that do the same for the same SPSite object. So ensure to dispose the RootWeb object only after the last access to it in your code whereever the logic of the code allows to determine this.&lt;br /&gt;Also please do not dispose the RootWeb property of SPContext.Current.Site. This object is used in many different places in SharePoint and you should not dispose it. It will automatically be cleaned up when the request finishes.&lt;br /&gt;&lt;br /&gt;-----------------------------------------------------------------------&lt;br /&gt;&lt;strong&gt;Dispose of objects which do not belong to the method?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In general SPSite and SPWeb objects should be disposed in the same method they get allocated. That's the best method to ensure that no disposed can be missed and to ensure that a dispose does not occur for an object that will be used later.&lt;br /&gt;I have seen several cases where custom code disposed SPWeb and SPSite objects incorrectly.&lt;br /&gt;&lt;br /&gt;A very common scenario is the following:&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;using (SPSite mySite = SPContext.Current.Site)&lt;br /&gt;{&lt;br /&gt;    ...&lt;br /&gt;}&lt;br /&gt;...&lt;br /&gt;Using "using" statements is a very nice method to ensure that at the end the object being used gets properly disposed. The problem in the code above is that SPContext.Current.Site and SPContext.Current.Web are not allowed to be disposed! Using successfully hides the dispose statement here. "Using" allows a nice structuring of the code so users often use it without thinking about the side effects.&lt;br /&gt;&lt;br /&gt;If you plan to use a using statement with SPContext you need to code it like this:&lt;br /&gt;...&lt;br /&gt;using (SPSite mySite = new SPSite(SPContext.Current.Site.ID))&lt;br /&gt;{&lt;br /&gt;    ...&lt;br /&gt;}&lt;br /&gt;...&lt;br /&gt;This method will ensure that a new independent SPSite object is created which you then can dispose without side effects on other code using the SPSite object bound to the current SPContext object.&lt;br /&gt;-----------------------------------------------------------------------&lt;br /&gt;&lt;strong&gt;Another common error is to dispose an SPSite or SPWeb object in a event receiver:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;public override void ItemCheckingOut(SPItemEventProperties properties)&lt;br /&gt;{&lt;br /&gt;...&lt;br /&gt;   // incorrect dispose of SPWeb&lt;br /&gt;   using (SPWeb web = properties.ListItem.Web)&lt;br /&gt;   {&lt;br /&gt;   }&lt;br /&gt;...&lt;br /&gt;   // incorrect dispose of SPSite&lt;br /&gt;   using (SPWeb site = properties.ListItem.Web.Site)&lt;br /&gt;   {&lt;br /&gt;   }&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;After executing our code other event receivers will receive an object where the underlaying SPWeb and/or SPSite object has been disposed. This can lead to exceptions.&lt;br /&gt;&lt;br /&gt;-----------------------------------------------------------------------&lt;br /&gt;// Do not do this. Dispose() is automatically called on SPWeb. &lt;br /&gt;using( SPWeb web = SPControl.GetContextWeb(HttpContext.Current)) { ... }&lt;br /&gt;SPContext objects are managed by the SharePoint framework and should not be explicitly disposed in your code. This is true also for the SPSite and SPWeb objects returned by SPContext.Site, SPContext.Current.Site, SPContext.Web, and SPContext.Current.Web.&lt;br /&gt;You must be cautious and aware of what the runtime is doing whenever you combine SharePoint object model calls on the same line. Leaks arising from this scenario are among the hardest to find.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-4375215411080862824?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/4375215411080862824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=4375215411080862824' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4375215411080862824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4375215411080862824'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/03/disposing-spweb-and-spsite-objects.html' title='Disposing SPWeb and SPSite objects'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-2772276059543936560</id><published>2009-03-09T23:06:00.000-07:00</published><updated>2009-06-27T09:29:44.378-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to customization status of a file, removing any customization</title><content type='html'>Hi ,&lt;br /&gt;&lt;br /&gt;This post deals with checking the customization status of any sharepoint file and if file is found to be customized then to remove its customiztion and reverting back to template file.&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using Microsoft.SharePoint;&lt;br /&gt;namespace CustomizationCheck {&lt;br /&gt; class Program {&lt;br /&gt;  static void Main (string[] args) {&lt;br /&gt;   using (SPSite siteCollection = new SPSite("http://sitename")) {&lt;br /&gt;    using (SPWeb site = siteCollection.RootWeb) {&lt;br /&gt;     SPFile file = site.GetFile("default.aspx");&lt;br /&gt;     // if file is customized, revert to underlying template file&lt;br /&gt;     if (file.CustomizedPageStatus == SPCustomizedPageStatus.Customized)&lt;br /&gt;        file.RevertContentStream();&lt;br /&gt;      } // SPWeb using statement&lt;br /&gt;    } // SPSite using statement&lt;br /&gt;   } // method “Main”&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;hr&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-2772276059543936560?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/2772276059543936560/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=2772276059543936560' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2772276059543936560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2772276059543936560'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/03/how-to-customization-status-of-file.html' title='How to customization status of a file, removing any customization'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-6064133478070264064</id><published>2009-03-04T03:56:00.000-08:00</published><updated>2009-03-04T04:35:08.833-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to stop ItemUpdate fire from ItemListener</title><content type='html'>Many tile it happens that we update an item and call custom Item added event listener.&lt;br /&gt;&lt;br /&gt;Now suppose , if we have to update some item of list in the event listner so the update event will get fire again from the listener and it will be a never endin g loop..&lt;br /&gt;&lt;br /&gt;In order to solve that, there is a one line solution...&lt;br /&gt;&lt;br /&gt;In the ItemUpdated event, &lt;br /&gt;&lt;br /&gt;put the following code:&lt;br /&gt;&lt;br /&gt;&lt;b&gt; this.DisableEventFire();&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;then update the list and again enable the same&lt;br /&gt;&lt;br /&gt;&lt;b&gt; this.EnableventFire();&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This will solve the issue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-6064133478070264064?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/6064133478070264064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=6064133478070264064' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6064133478070264064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6064133478070264064'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/03/how-to-stop-itemupdate-fire-from.html' title='How to stop ItemUpdate fire from ItemListener'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-2512308746902638349</id><published>2009-03-03T20:41:00.000-08:00</published><updated>2009-04-10T10:07:45.562-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to set Item Level Permission in to Sharepoint List</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;Today I will discuss how to revoke Item level permission and how to grant Item Level permission on a sharepoint list to a user.&lt;br /&gt;&lt;br /&gt;Before discussing the code, I would like to tell you something about some properties used in the code:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SPList.RoleAssignments Property :&lt;/strong&gt;&lt;br /&gt;Gets the collection of role assignments for the list.&lt;br /&gt;Namespace: Microsoft.SharePoint&lt;br /&gt;Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SPRoleAssignment.RoleDefinitionBindings Property : &lt;/strong&gt;Gets the collection of role definition bindings for the role assignment.&lt;br /&gt;Namespace: Microsoft.SharePoint&lt;br /&gt;Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SPPrincipal Class :&lt;/strong&gt;&lt;br /&gt;Represents a user or group that can be assigned permissions in Windows SharePoint Services to control security.&lt;br /&gt;Namespace: Microsoft.SharePoint&lt;br /&gt;Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)&lt;br /&gt;&lt;br /&gt;I have written a function that will take the following parameters:&lt;br /&gt;&lt;br /&gt;1. string Site url&lt;br /&gt;2. string Library name&lt;br /&gt;3. string Old user name (format : &amp;LT;domainname&amp;GT;\&amp;LT;username&amp;GT;&lt;br /&gt;4. string new user name (format : &amp;LT;domainname&amp;GT;\&amp;LT;username&amp;GT;&lt;br /&gt;&lt;br /&gt;My whole intension of function is to revoke permission of the item from old user and assign it to new user. You may or may not require the new user parameter if you are only revoking access.&lt;br /&gt;&lt;br /&gt;public static void SetItemPermission(string SitePath, string LibName, string OldUser, string NewUser)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;   SPSecurity.RunWithElevatedPrivileges(delegate()&lt;br /&gt;       {&lt;br /&gt;           using (SPSite WebApp = new SPSite(SitePath))&lt;br /&gt;          {&lt;br /&gt;                using (SPWeb Site = WebApp.OpenWeb())&lt;br /&gt;                  {&lt;br /&gt;                       SPList list = Site.Lists[LibName];&lt;br /&gt;                       SPQuery newSPQuery = new SPQuery();&lt;br /&gt;                       newSPQuery.Query = "&amp;LT;where&amp;GT;&amp;LT;contains&amp;GT;&amp;LT;fieldref name="\"&amp;GT;" +&lt;br /&gt;                           "&amp;LT;value type="\"&amp;GT;" + OldUser + "&amp;LT;/value&amp;GT;" + "&amp;LT;/contains&amp;GT;&amp;LT;/where&amp;GT;";&lt;br /&gt;                         try{&lt;br /&gt;                                       SPListItemCollection listItemCol = list.GetItems(newSPQuery);&lt;br /&gt;                                         if (listItemCol.Count &amp;GT; 0)&lt;br /&gt;                                           {&lt;br /&gt;                                                 SPUser user = null, _newUser = null;&lt;br /&gt;                                                 SPRoleAssignment role = null;&lt;br /&gt;                                                 foreach (SPListItem item in listItemCol)&lt;br /&gt;                                                   {&lt;br /&gt;                                                         user = Site.Users[OldUser];&lt;br /&gt;                                                         SPPrincipal principal = (SPPrincipal)user;&lt;br /&gt;                                                         item.RoleAssignments.Remove(principal);&lt;br /&gt;                                                        role = new SPRoleAssignment(NewUser, "", "", "");&lt;br /&gt;                                                        role.RoleDefinitionBindings.Add(Site.RoleDefinitions["Contribute"]);&lt;br /&gt;                                                       item.RoleAssignments.Add(role);&lt;br /&gt;                                               }&lt;br /&gt;                                               item.SystemUpdate(false);&lt;br /&gt;                                       }&lt;br /&gt;                                  }}catch(Exception ex){}&lt;br /&gt;                       }&lt;br /&gt;                 }&lt;br /&gt;            });&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;#endregion&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-2512308746902638349?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/2512308746902638349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=2512308746902638349' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2512308746902638349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2512308746902638349'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/03/how-to-set-item-level-permission-in-to.html' title='How to set Item Level Permission in to Sharepoint List'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-6886839103086171788</id><published>2009-02-25T20:53:00.000-08:00</published><updated>2009-02-25T21:30:09.130-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How to access SharePoint User Profile from C# code</title><content type='html'>Hi All,&lt;br /&gt;&lt;br /&gt;We all know sharepoint user profile stores users information. Sometimes we use out of box features to update these profile values like mysite stc but many times we come across the situation where we need to access uer profile from code, update the properties and save the profile.&lt;br /&gt;&lt;br /&gt;In this post, I will tell you the step by step way to access user profile and to access/update the property field.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Refer the following dlls in the code:&lt;br /&gt;&lt;br /&gt;using Microsoft.SharePoint;&lt;br /&gt;using Microsoft.SharePoint.Administration;&lt;br /&gt;using Microsoft.Office.Server;&lt;br /&gt;using Microsoft.Office.Server.UserProfiles;&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Create the instance of SPSite object:&lt;br /&gt;&lt;br /&gt;using (SPSite ospSite=new SPSite("http://servername:portname")&lt;br /&gt;{}&lt;br /&gt;&lt;br /&gt;where http://servername:portname is your sharepoint application url.&lt;br /&gt;Here we have used using to create the instance of SPSite since 'using' automatically disposes the object when the block gets finished.&lt;br /&gt;&lt;br /&gt;Withing 'using' block , add the following codes:&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Create the instance of servercontext object:&lt;br /&gt;&lt;br /&gt;ServerContext ospServerContext = ServerContext.GetContext(ospSite);&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Create the instance of userporfile object propertycollection object:&lt;br /&gt;&lt;br /&gt;UserProfileManager ospUserProfileManager = new UserProfileManager(ospServerContext);&lt;br /&gt;UserProfile ospUserProfile = ospUserProfileManager.GetUserProfile(UniqueId);&lt;br /&gt;Microsoft.Office.Server.UserProfiles.PropertyCollection propColl = ospUserProfile.ProfileManager.PropertiesWithSection;&lt;br /&gt;&lt;br /&gt;here uniqueid is the id by which each profile is recognized individually. Eacn user profile has a uniqueId many ny 5-2-1 id if it is an AD account or GUID.&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; Check whether the USerprofile object is null or not&lt;br /&gt;&lt;br /&gt;     if (ospUserProfile != null &amp;&amp; propColl != null)&lt;br /&gt;     {}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 6:&lt;/strong&gt; Iterate thorugh all the proerties in property collection:&lt;br /&gt;&lt;br /&gt; foreach (Property prop in propColl)&lt;br /&gt; {}&lt;br /&gt;&lt;br /&gt;In the for loop you can get the property name and value like this:&lt;br /&gt;&lt;br /&gt;To get property name:    prop.Name&lt;br /&gt;To get property value:   ospUserProfile[prop.Name].Value &lt;br /&gt;&lt;br /&gt;To set a value to a proerty : ospUserProfile[prop.Name].Value ="SOME VALUE";&lt;br /&gt;&lt;br /&gt;To save the user profile after updation: ospUserProfile.Commit();&lt;br /&gt;&lt;br /&gt;This will get the userporfile of a user and update the profile.&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;The whole code is as follows:&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Data.SqlClient;&lt;br /&gt;using Microsoft.SharePoint;&lt;br /&gt;using Microsoft.SharePoint.Administration;&lt;br /&gt;using Microsoft.Office.Server;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Data;&lt;br /&gt;using Microsoft.Office.Server.UserProfiles;&lt;br /&gt;&lt;br /&gt;namespace Program1&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;public static void Main(string args[])&lt;br /&gt;{&lt;br /&gt;using (SPSite ospSite = new SPSite(webApp))&lt;br /&gt;  {&lt;br /&gt;   try&lt;br /&gt;   {&lt;br /&gt;    ServerContext ospServerContext = ServerContext.GetContext(ospSite);&lt;br /&gt;    UserProfileManager ospUserProfileManager = new UserProfileManager(ospServerContext);&lt;br /&gt;    UserProfile ospUserProfile = ospUserProfileManager.GetUserProfile(uniqueId);&lt;br /&gt;    Microsoft.Office.Server.UserProfiles.PropertyCollection propColl = ospUserProfile.ProfileManager.PropertiesWithSection;&lt;br /&gt;&lt;br /&gt;   if (ospUserProfile != null &amp;&amp; propColl != null)&lt;br /&gt;   {&lt;br /&gt;    foreach (Property prop in propColl)&lt;br /&gt;     {&lt;br /&gt;      Console.WriteLine("property Name : " + prop.Name);                             &lt;br /&gt;      Console.WriteLine("proerpty Value :  " + ospUserProfile[prop.Name].Value);&lt;br /&gt;&lt;br /&gt;     //If updation is required&lt;br /&gt;     ospUserProfile[prop.Name].Value="SOME VALUE";&lt;br /&gt;&lt;br /&gt;     }&lt;br /&gt;     ospUserProfile.Commit();&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  catch(Exception ex){&lt;br /&gt;   Console.WriteLine(ex.Message);&lt;br /&gt;   }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;hr&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-6886839103086171788?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/6886839103086171788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=6886839103086171788' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6886839103086171788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6886839103086171788'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/02/how-to-access-sharepoint-user-profile.html' title='How to access SharePoint User Profile from C# code'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-4894919063347225944</id><published>2009-02-23T23:25:00.000-08:00</published><updated>2009-06-27T08:38:56.794-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.Net'/><title type='text'>How to get old index value of dropdown when index change occures</title><content type='html'>Many times user faces this situation: A dropdown with some values. User selected a value and SelectdIndexChanged event fires. &lt;br /&gt;In the code block, one can get the current index value of dropdown but what if old value is required. that is value before selecting the new index.&lt;br /&gt;&lt;br /&gt;The simple solution is to use viewstate to hold the old value:&lt;br /&gt;&lt;br /&gt;Suppose we have a dropdown 'dropdown1' with some item values.&lt;br /&gt;&lt;br /&gt;Steps:&lt;br /&gt;1.In code behind, we defined a public property IndexVal that store and fetch dropdown index value from a viewstate variable:&lt;br /&gt;&lt;br /&gt;public int IndexVal {&lt;br /&gt;      get&lt;br /&gt;         {&lt;br /&gt;             return Convert.ToInt32(ViewState["OldSelectedIndex"]);&lt;br /&gt;         }&lt;br /&gt;     set {&lt;br /&gt;             ViewState["OldSelectedIndex"] = DropDownList1.SelectedIndex;&lt;br /&gt;         }&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;2. When the page loads for 1st time, set the viewstate value to dropdown index value&lt;br /&gt;&lt;br /&gt;    if (!IsPostBack)&lt;br /&gt;         IndexVal = DropDownList1.SelectedIndex;&lt;br /&gt;&lt;br /&gt;3. When SelectedIndexChanged event fires, we can get the old index value from viewstate and new index value from the dropdown itself.&lt;br /&gt;Then set the viewstate with new value.&lt;br /&gt;&lt;br /&gt;    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)&lt;br /&gt;     {&lt;br /&gt;        int oldValue IndexVal;&lt;br /&gt;        int newValue DropDownList1.SelectedIndex;&lt;br /&gt;        IndexVal = DropDownList1.SelectedIndex;&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Varun Sharma&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-4894919063347225944?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/4894919063347225944/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=4894919063347225944' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4894919063347225944'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4894919063347225944'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/02/how-to-get-old-index-value-of-dropdown.html' title='How to get old index value of dropdown when index change occures'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-7795416453063556363</id><published>2009-02-21T00:36:00.000-08:00</published><updated>2009-06-27T08:38:37.337-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.Net'/><title type='text'>Javascript call from Master page and content Page -Part I</title><content type='html'>Create a JavaScript function on the fly and call the JavaScript function in the MasterPage Page_Load() event&lt;br /&gt;C#&lt;br /&gt;    protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        string someScript = "";&lt;br /&gt;        someScript = "&lt;script language="'javascript'"&gt;alert('Called from CodeBehind');&lt;/script&gt;";&lt;br /&gt;        Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", someScript);&lt;br /&gt;    }&lt;br /&gt;VB.NET&lt;br /&gt;    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load&lt;br /&gt;        Dim someScript As String = ""&lt;br /&gt;        someScript = "&lt;script language="'javascript'"&gt;alert('Called from CodeBehind');&lt;/script&gt;"&lt;br /&gt;        Page.ClientScript.RegisterStartupScript(Me.GetType(), "onload", someScript)&lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt;The Page.ClientScript.RegisterStartupScript() allows you to emit client-side script blocks from code behind. More info can be found over here http://msdn.microsoft.com/en-us/library/system.web.ui.clientscriptmanager.registerstartupscript.aspx&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-7795416453063556363?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/7795416453063556363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=7795416453063556363' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7795416453063556363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/7795416453063556363'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/02/javascript-call-from-master-page-and.html' title='Javascript call from Master page and content Page -Part I'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-3027377737416241820</id><published>2009-02-10T21:41:00.000-08:00</published><updated>2009-06-27T08:37:07.117-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><title type='text'>Using Lambard Expression</title><content type='html'>&lt;p&gt;Lambda Expressions are based on functional calculus—Lambda Calculus—from the 1930s, and Lambda Expressions exist in other languages.Think of Lambda Expressions as brief inline functions whose concise nature is an ideal fit for LINQ.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Lambda Expressions are written with a left side, the =&gt; symbol, and a right side, as in(x,y) =&gt; x + y;.&lt;br /&gt;The left side represents the input arguments and the right side is theexpression to be evaluated. &lt;/p&gt;&lt;p&gt;For example(x,y) =&gt; x + y;is read x and y goes to—or as I read it gosinta—the function x + y. &lt;/p&gt;&lt;p&gt;Implicit in the expression is the return result of x + y. &lt;/p&gt;&lt;p&gt;The input argument or arguments can be inferred and generated by the compiler, called implicit arguments, or expressed explicitly by you.&lt;br /&gt;The preceding Lambda Expression can also be rewritten as(int x, int y) =&gt; x + y;&lt;br /&gt;&lt;br /&gt;class Program{  &lt;/p&gt;&lt;p&gt;static void Main(string[] args)  {  &lt;/p&gt;&lt;p&gt; Func&amp;LT;int, int, int&amp;GT; add =     (int x, int y) =&amp;GT; x + y;     Console.WriteLine(add(3, 4));     Console.ReadLine();  }}[/code]&lt;br /&gt;You can begin exploring how Lamba Expressions support LINQ queries by seeing howLambda Expressions are used in extension methods such as Select&lt;t&gt;, Where&lt;t&gt;, orOrderBy&lt;t&gt;.&lt;br /&gt;&lt;b&gt;Using Select&amp;LT;T&amp;GT; with Lambda Expressions&lt;/b&gt;&lt;br /&gt;Check the following example:[code] var numbers = new int[]{1,2,3,4,5,6}; foreach(var result in numbers.Select(n =&amp;GT; n)) Console.WriteLine(result);[/code]&lt;br /&gt;Here we are executing the SELECT * behavior of SQL queries by initializing the Select extension method with n =&gt; n. n =&gt; n means that n is the input and you want to return n.&lt;br /&gt;&lt;b&gt;Using Where&amp;LT;T&amp;GT; with Lambda Expressions&lt;/b&gt;&lt;br /&gt;The Where&lt;t&gt; extension method is employed in scenarios where you would use conditional logic to filter the elements returned in a resultset. Like Select, Where returns an IEnumerable&lt;t&gt;, where T is defined by the type of the result from the Lambda Expression.&lt;br /&gt;[code] var words = new string[]{"Drop", "Dead", "Fred"}; IEnumerable&amp;LT;string&amp;GT; hasDAndE = words.Where(s =&amp;GT; s.Contains('D') &amp;amp;&amp;amp;    s.Contains('e')); foreach(string s in hasDAndE) Console.WriteLine(s);[/code]&lt;br /&gt;&lt;b&gt;Using OrderBy&amp;LT;T&amp;GT; with Lambda Expressions&lt;/b&gt;&lt;br /&gt;OrderBy&lt;t&gt; is the extension method that supports sorting. OrderBy accepts a Func genericdelegate. The Func argument can be expressed with a literal Lambda Expression.&lt;br /&gt;[code]&lt;br /&gt;var numbers = new int[] {1, 3, 5, 7, 9, 2, 4, 6, 8, 10 };IEnumerable&amp;LT;int&amp;GT; ordered = numbers.OrderBy(n=&amp;GT;n); foreach(var num in ordered)  Console.WriteLine(num);[/code]&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-3027377737416241820?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/3027377737416241820/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=3027377737416241820' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/3027377737416241820'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/3027377737416241820'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/02/using-lambard-expression.html' title='Using Lambard Expression'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-2390973123654172162</id><published>2009-02-10T21:11:00.000-08:00</published><updated>2009-06-27T08:36:49.606-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><title type='text'>Using Conversion Types</title><content type='html'>A very common task is converting data from one form to another.&lt;br /&gt;The new version of .NET has conversion operators ToArray, OfType, Cast, AsEnumerable, ToList, ToDictionary, and ToLookup. We will discuss each one by one:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ToArray : &lt;/strong&gt;Arrays are fast but not very convenient. It is tedious to write array management code when collections like List&lt;t&gt; make managing data easier.The main reason, dot net framework supprots ToArray because many legacy code and API supprots uses ToArray till now.&lt;br /&gt;&lt;strong&gt;OfType : &lt;/strong&gt;The conversion operator OfType&lt;t&gt; returns an IEnumerable&lt;t&gt; collection of only the types defined by the parameter T. For example, initializing a list of objects where some are integers, you can quickly extract just the integers&lt;br /&gt; var numbers = new object[]{1, "two", null, "3", 4};&lt;br /&gt; foreach(var anInt in numbers.OfType&lt;int&gt;())&lt;br /&gt;      Console.WriteLine(anInt);&lt;br /&gt;&lt;strong&gt;Cast: &lt;/strong&gt;To receive an exception if elements of the source type cannot be converted to the target type, use the Cast &lt;t&gt; conversion operator.&lt;br /&gt;&lt;strong&gt;AsEnumerable : &lt;/strong&gt;Many types implement IEnumerable.AsEnumerable Forces an Object That Implements IEnumerable to Use theBehaviors of the IEnumerable Interface.&lt;br /&gt;&lt;strong&gt;ToList: &lt;/strong&gt;The ToList conversion operator forces an immediate query evaluation and stores the results in a List&lt;t&gt;.&lt;br /&gt;&lt;strong&gt;ToDictionary:&lt;/strong&gt;A dictionary is a collection of name and value pairs. ToDictionary converts anIEnumerable&lt;t&gt; object—such as is returned from a LINQ query—into anIDictionary&lt;key,&gt; object.&lt;br /&gt;&lt;strong&gt;ToLookup:&lt;/strong&gt;ToLookup converts an IEnumerable&lt;t&gt; to a Lookup&lt;key,&gt; type. Lookup is like a dictionary, but where a Dictionary uses a single key value, Lookup maps keys to a collection of values. Lookups have no public constructor and are immutable. You cannot add or remove elements or keys after they are created.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Summary: &lt;/strong&gt;&lt;br /&gt;Compound type initialization makes it easier to initialize arrays and lists and is an essential capability for initializing anonymous types. Conversion operators take some of the tedium out of converting between convenient types and other types. More important, this chapter demonstrates the classic onion layering of complexity in .NET that makes it possible to do a lot of work with relatively few lines of code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-2390973123654172162?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/2390973123654172162/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=2390973123654172162' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2390973123654172162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/2390973123654172162'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/02/using-conversion-types.html' title='Using Conversion Types'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-6679710669789258885</id><published>2009-02-10T04:32:00.000-08:00</published><updated>2009-06-27T08:36:28.105-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><title type='text'>Introduction to LINQ - Part 2 - Anonymous types</title><content type='html'>Before jumping right into the LINQ asnd its implementation, I would like to introduce some new features of dot net framwork 3.0/3.5 that were incorporated to support LINQ.&lt;br /&gt;&lt;br /&gt;In this article, we will discuss &lt;strong&gt;Anonymous types&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;First thing about Anonymous types is that it uses the keyword &lt;strong&gt;var&lt;/strong&gt;. The var introduced with .NET 3.5 indicates an anonymous types. A developer who has worked in VB6, may say that var was there in VB6 also. So what's the difference?&lt;br /&gt;&lt;br /&gt;Anonymous types defined with var are not similar to VB variant. So what is var?&lt;br /&gt;&lt;em&gt;The var keyword signals the compiler to emit a strong type based on the value of the operator on the right side.&lt;/em&gt;&lt;br /&gt;&lt;p&gt;A simple anonymous type begines with a var keyword, the assignment operator and a &lt;strong&gt;not null initial value.&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;var title="Tutorial on LINQ";&lt;/p&gt;&lt;p&gt;here the data type of var will be set based on the data type of the right hand side. So the datatype of title will be string.&lt;/p&gt;&lt;p&gt;As you will notice that I have mentioned that we need to assigna 'not null initial value'.&lt;/p&gt;&lt;p&gt;Anonymous types must always have an initial assignment and it can’t be nullbecause the type is inferred and fixed to the initializer.&lt;/p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br /&gt;Anonymous types are strong typeswhere the compiler does the work of figuring out the actual type and writing the classimplementation, if the anonymous type is a composite type.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-6679710669789258885?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/6679710669789258885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=6679710669789258885' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6679710669789258885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/6679710669789258885'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/02/introduction-to-linq-part-2-anonymous.html' title='Introduction to LINQ - Part 2 - Anonymous types'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-8613986424316723413</id><published>2009-02-10T03:50:00.000-08:00</published><updated>2009-06-27T08:36:04.743-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><title type='text'>Introduction to LINQ - Part 1</title><content type='html'>&lt;div&gt;&lt;a href="http://4.bp.blogspot.com/_AififblDFCg/SZFtloOqdgI/AAAAAAAAA5o/-5-F0hTmzds/s1600-h/147428__Linq1.jpg"&gt;&lt;/a&gt;Microsoft dot net framework 3.0 introduced new feature named LINQ. &lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;What is LINQ&lt;/b&gt; :&lt;br /&gt;Language Integrated Query (LINQ) is a methodology that simplifies and unifies the implementation of any kind of data access.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;Why LINQ:&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;The main objective behind LINQ was to address the concept related problems and technical difficulties encountered when using databases with .NET programming languages.&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;The two main intention of introducing LINQ were:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;provide a solution for the problem of object-relational mapping&lt;/li&gt;&lt;li&gt;simplify the interaction between objects and data sources&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;LINQ eventually evolved into a general-purpose language-integrated querying toolset. This toolset can be used to access data coming from in-memory objects (LINQ to Objects), databases (LINQ to SQL), XMLdocuments (LINQ to XML), a file-system, or any other source.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://3.bp.blogspot.com/_AififblDFCg/SZFuTLWzIOI/AAAAAAAAA5w/I8c0_D8iFSI/s1600-h/147428__Linq1.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5301139512136769762" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 400px; CURSOR: hand; HEIGHT: 258px" alt="" src="http://3.bp.blogspot.com/_AififblDFCg/SZFuTLWzIOI/AAAAAAAAA5w/I8c0_D8iFSI/s400/147428__Linq1.jpg" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Advantage of LINQ&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Developers can use LINQ with any data source.&lt;/strong&gt;&lt;/em&gt; &lt;/p&gt;&lt;p&gt;They can express efficient query behavior in their programming language of choice, optionally transform/shape data query results into whatever format they want, and then easily manipulate the results. &lt;/p&gt;&lt;p&gt;&lt;strong&gt;LINQ-enabled languages can provide full type-safety &lt;/strong&gt;and compile-time checking of query expressions, and development tools can provide full intellisense, debugging, and rich refactoring support when writing LINQ code.LINQ supports a very rich extensibility model that facilitates the creation of ery efficient domain-specific operators for data sources. &lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-8613986424316723413?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/8613986424316723413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=8613986424316723413' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8613986424316723413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/8613986424316723413'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2009/02/introduction-to-linq-part-1.html' title='Introduction to LINQ - Part 1'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_AififblDFCg/SZFuTLWzIOI/AAAAAAAAA5w/I8c0_D8iFSI/s72-c/147428__Linq1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-4087190828686324180</id><published>2008-01-04T05:46:00.001-08:00</published><updated>2009-06-27T08:35:00.488-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Interview Experience'/><title type='text'>Interview with Wipro</title><content type='html'>&lt;p&gt;1. Difference between dot net framework 1.1 and 2.0&lt;/p&gt;&lt;p&gt;2. Difference between datagrid and gridview&lt;/p&gt;&lt;p&gt;3. &lt;a href="http://ado.net/" target="_blank"&gt;ADO.NET&lt;/a&gt; architecture&lt;/p&gt;&lt;p&gt;4. How garbage collection works&lt;/p&gt;&lt;p&gt;5. Level of GC&lt;/p&gt;&lt;p&gt;6. Which class to use for xml manipulation&lt;/p&gt;&lt;p&gt;7. Diff between XML reader and XML Document class&lt;/p&gt;&lt;p&gt;8. How to jump to particular node without traversing&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-4087190828686324180?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/4087190828686324180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=4087190828686324180' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4087190828686324180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/4087190828686324180'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2008/01/interview-with-wipro.html' title='Interview with Wipro'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-88887553752935902.post-1598794638555459004</id><published>2007-11-13T01:15:00.000-08:00</published><updated>2009-06-27T08:34:36.619-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Interview Experience'/><title type='text'>Interview with IBM</title><content type='html'>these are the questions asked in IBM interview...&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Rate yourself in ASP and ASP.NET&lt;/li&gt;&lt;li&gt;Rate yourself in VB&lt;/li&gt;&lt;li&gt;What is Activex Object?&lt;/li&gt;&lt;li&gt;How many types of ActiveX objects are there?&lt;/li&gt;&lt;li&gt;What is diff between ActiveX DLL and ActiveX EXE?&lt;/li&gt;&lt;li&gt;When to use ActiveX DLL and when to use ActiveX EXE?&lt;/li&gt;&lt;li&gt;What is COM+?&lt;/li&gt;&lt;li&gt;How you can use COM in .NET?&lt;/li&gt;&lt;li&gt;What is assembly?&lt;/li&gt;&lt;li&gt;What are different parts of assembly?&lt;/li&gt;&lt;li&gt;How many types of assemblies are there?&lt;/li&gt;&lt;li&gt;What is singleton assembly?&lt;/li&gt;&lt;li&gt;What is Satellite assembly and how to create it?&lt;/li&gt;&lt;li&gt;What is the difference bewteen datareader and dataadapter?&lt;/li&gt;&lt;li&gt;What is Dataset? Explain..&lt;/li&gt;&lt;li&gt;How to establish a conn to a database?&lt;/li&gt;&lt;li&gt;How to fetch data using datareader and sqldataadapter?&lt;/li&gt;&lt;li&gt;What are various autentication mode in IIS?&lt;/li&gt;&lt;li&gt;What is difference between authentication and authorisation?&lt;/li&gt;&lt;li&gt;Explain authentication process.. what changes is required in web.config?&lt;/li&gt;&lt;li&gt;How to impliment exception handling in ASP.NET?&lt;/li&gt;&lt;li&gt;How to handle application error/exception in ASP?&lt;/li&gt;&lt;li&gt;What is GAC?&lt;/li&gt;&lt;li&gt;Why GAC is required?&lt;/li&gt;&lt;li&gt;What is Normalization?&lt;/li&gt;&lt;li&gt;Explain different types of Normalization Form with examples.&lt;/li&gt;&lt;li&gt;What is trigger?&lt;/li&gt;&lt;li&gt;Explain difference between AFTER and INSTEAD OF triggers.&lt;/li&gt;&lt;li&gt;What is transaction?&lt;/li&gt;&lt;li&gt;Explain ACID property of trancation.&lt;/li&gt;&lt;li&gt;Write the code of how to implemnt trancation in ASP.NET.&lt;/li&gt;&lt;li&gt;How many types of joins are there?&lt;/li&gt;&lt;li&gt;Write a query to show cross join?&lt;/li&gt;&lt;li&gt;Explain the concepts of OOPS?&lt;/li&gt;&lt;li&gt;Diff between interface and abstract class?&lt;/li&gt;&lt;li&gt;Use of sealed keyword?&lt;/li&gt;&lt;li&gt;How to hide data member and function member of base class?&lt;/li&gt;&lt;li&gt;Explain inheritance.&lt;/li&gt;&lt;li&gt;What is ADO?&lt;/li&gt;&lt;li&gt;What is cursor type and lock type?&lt;/li&gt;&lt;li&gt;How many cursor types are there and what are the uses of each one of them?&lt;/li&gt;&lt;li&gt;How will you delcare user defined data types in javascript? &lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span&gt;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/88887553752935902-1598794638555459004?l=firstblogofvarun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://firstblogofvarun.blogspot.com/feeds/1598794638555459004/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=88887553752935902&amp;postID=1598794638555459004' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1598794638555459004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/88887553752935902/posts/default/1598794638555459004'/><link rel='alternate' type='text/html' href='http://firstblogofvarun.blogspot.com/2007/11/interview-with-ibm.html' title='Interview with IBM'/><author><name>Varun Sharma</name><uri>http://www.blogger.com/profile/10813932223058908394</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_AififblDFCg/SivWw8sQ2YI/AAAAAAAABCg/XsTWEg-zAuw/S220/1.jpg'/></author><thr:total>3</thr:total></entry></feed>
