<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">.Net</title><subtitle type="html" /><id>http://www.fuzzydev.com/blogs/dotnet/atom.aspx</id><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/default.aspx" /><link rel="self" type="application/atom+xml" href="http://www.fuzzydev.com/blogs/dotnet/atom.aspx" /><generator uri="http://communityserver.org" version="2.0.60404.2676">Community Server</generator><updated>2006-06-08T18:38:00Z</updated><entry><title>Shrink SQL Server Log File</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/08/19/Shrink_SQL_Server_Log_File.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/08/19/Shrink_SQL_Server_Log_File.aspx</id><published>2006-08-19T10:07:00Z</published><updated>2006-08-19T10:07:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial&gt;I have hosted my site on a shared hosting server and have to live with the reality of limited database/web space, recently my database space was shooting up and I was really worried about it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;My posting (blogs) are not too long to reach a whopping 114 MB and so I was stunned to see the database size. After carefull investigation of each table I thought of checking at database level using the below given sp...&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#800000 size=2&gt;
&lt;P&gt;sp_helpdb&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;'DATABASE_NAME'&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT face=Arial color=#000000 size=3&gt;To my surprise I found the data file size as 10 MB and 104 MB was my log file. After googling for right way to shrink the log file, I found a really simple and perfect one...&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;USE&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;FONT color=#ff0000&gt;DATABASE_NAME&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;GO&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;
&lt;P&gt;-- Truncate the log by changing the database recovery model to SIMPLE.&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;ALTER&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;DATABASE&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000&gt;DATABASE_NAME&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;SET&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; RECOVERY SIMPLE&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;GO&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;
&lt;P&gt;-- Shrink the truncated log file to 1 MB.&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;DBCC&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; SHRINKFILE &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;&lt;FONT color=#ff0000&gt;LOF_FILE_NAME&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; 1&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;);&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;GO&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;
&lt;P&gt;-- Reset the database recovery model.&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;ALTER&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;DATABASE&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000&gt;DATABASE_NAME&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;SET&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; RECOVERY &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;FULL&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;GO&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000000 size=3&gt;The above solution was taken from &lt;A href="http://msdn2.microsoft.com/en-us/library/ms189493.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms189493.aspx&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=58" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry><entry><title>ASP.Net 2.0 DataList Control - Basics</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/08/08/ASPNet2_DataList_Control_Basics.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/08/08/ASPNet2_DataList_Control_Basics.aspx</id><published>2006-08-08T10:46:00Z</published><updated>2006-08-08T10:46:00Z</updated><content type="html">&lt;P&gt;DataList control is a template driven data control which allows us to display a list of data in a customizable format. Simply speaking we will define how the data is to be displayed and assign a data source, the control in turn uses the data source and simply displays the data using the definition. The power of this control is realized when we need to perform some operation on the displayed data.&lt;/P&gt;
&lt;P&gt;At the end of this post we will be able to perform some common operations using DataList control, we will walkthrough a development scenario, imagine we are developing a blog site and one of the page will allow us to manage the blog categories. We will leverage the DataList control to achieve the below given objectives&lt;/P&gt;
&lt;H2&gt;Objective&lt;/H2&gt;
&lt;LI&gt;Display blog categories 
&lt;LI&gt;Edit/Update blog categories 
&lt;LI&gt;Delete blog categories 
&lt;LI&gt;Add new blog category 
&lt;H2&gt;How to...?&lt;/H2&gt;
&lt;P&gt;Hmm.. that's a very basic and common operation, we will configure our DataList control to use the ObjectDataSource control, so that it brings the blog categories from the database and hands it over to the DataList control. &lt;STRONG&gt;One important thing to note is once you configure the data source of the DataList control set the DataKeyField to a primary/unique field&lt;/STRONG&gt;. This is how the control looks in default template after binding it with ObjectDatasourceControl&lt;/P&gt;
&lt;H4&gt;DataList control default template&lt;/H4&gt; 
&lt;IMG src="/ScreenShots/DataList_DefaultTemplate.JPG" border="0" /&gt;
&lt;P&gt;Ok so now let's sprinkle some color on this little beauty and make it look more adorable, use the Autoformat option and select a scheme of your choice. &lt;/P&gt;
&lt;P&gt;Here comes the fun part, we will now define how our data will be displayed, right click on the DataList control and go to "Edit Template" -&gt; "Item Templates", &lt;/P&gt;
&lt;H4&gt;DataList control edit item template mode&lt;/H4&gt;
&lt;IMG src="/ScreenShots/DataList_EditItemTemplate.JPG" border="0" /&gt;
&lt;P&gt;In the above image you will notice that there are four sections, &lt;/P&gt;
&lt;LI&gt;Item Template 
&lt;LI&gt;Alternating Item Template 
&lt;LI&gt;Selected Item Template 
&lt;LI&gt;Edit Item Template 
&lt;P&gt;The template names are self explanatory so I won't brag about them, edit item template is going to be our point of focus, let's just remove the "Id" field from the templates as we don't want to display that field, we are only going to display the blog category and we will be able to edit the category description.&lt;/P&gt;
&lt;P&gt;Now let's drop a textbox control inside the edit item template and configure it's datasource, with this we are asking the DataList control "hey whenever the control is in edit mode display this textbox with the category description".&lt;/P&gt;
&lt;P&gt;Now drop two LinkButton control's in Item Template, one for Edit and the other one for Delete and set the CommandName to "EDIT" and "DELETE" respectively.&lt;/P&gt;
&lt;P&gt;Similarly drop two LinkButton control's in Edit ItemTemplate, one for Update and one for Cancel operation set their CommandName to "UPDATE" and "CANCEL" respectively. Below given is the snapshot&lt;/P&gt;
&lt;IMG src="/ScreenShots/DataList_EditDeleteConfigured.JPG" border="0" /&gt;

&lt;IMG src="/ScreenShots/DataList_UpdateCancelConfigured.JPG" border="0" /&gt;

&lt;P&gt;We have the UI ready for Edit,Update and Delete operations, only thing missing from the list is a way to add new blog category. For this we will use the footer template and add one Textbox control to allow the user to input the description and a Linkbutton to perform an add operation. Below given is the snapshot of the DataList control after the template modifications. &lt;/P&gt;
&lt;IMG src="/ScreenShots/DataList_AddNew_FooterTemplate.JPG" border="0" /&gt; 

&lt;P&gt;Now let's look at the event arsenal of DataList control, there are 5 events which sounds interesting, allow me to list down these events&lt;/P&gt;
&lt;LI&gt;EditCommand 
&lt;LI&gt;UpdateCommand 
&lt;LI&gt;CancelCommand 
&lt;LI&gt;DeleteCommand 
&lt;LI&gt;ItemCommand 
&lt;P&gt;The first four events are perfect for our needs, but what about adding new blog category this is where ItemCommand is useful. So far so good and we still have our hands neat and clean, but we will get our hands dirty with some code. Let's subscribe to all the five events and write some code. &lt;/P&gt;&lt;PRE&gt;&lt;H3&gt;//EditCommand&lt;/H3&gt;
&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;protected&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; DataList1_EditCommand(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;object&lt;/FONT&gt;&lt;FONT size=2&gt; source, &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;DataListCommandEventArgs&lt;/FONT&gt;&lt;FONT size=2&gt; e)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt; (e.CommandName == &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"EDIT"&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;DataList1.EditItemIndex = e.Item.ItemIndex;&lt;/P&gt;&lt;P&gt;DataList1.DataBind();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;
&lt;H3&gt;//UpdateCommand&lt;/H3&gt;
&lt;FONT color=#0000ff size=2&gt;protected&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; DataList1_UpdateCommand(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;object&lt;/FONT&gt;&lt;FONT size=2&gt; source, &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;DataListCommandEventArgs&lt;/FONT&gt;&lt;FONT size=2&gt; e)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt; (e.CommandName == &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"UPDATE"&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; sId = DataList1.DataKeys[e.Item.ItemIndex].ToString();&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; sDesc = ((&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;TextBox&lt;/FONT&gt;&lt;FONT size=2&gt;)e.Item.FindControl(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"DescText"&lt;/FONT&gt;&lt;FONT size=2&gt;)).Text;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;BlogCategory&lt;/FONT&gt;&lt;FONT size=2&gt; objBlogCategory = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;BlogCategory&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Convert&lt;/FONT&gt;&lt;FONT size=2&gt;.ToInt32(sId));&lt;/P&gt;&lt;P&gt;objBlogCategory.Description = sDesc;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;BlogManager&lt;/FONT&gt;&lt;FONT size=2&gt;.UpdateBlogCategory(objBlogCategory);&lt;/P&gt;&lt;P&gt;DataList1.EditItemIndex = -1;&lt;/P&gt;&lt;P&gt;DataList1.DataBind();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;
&lt;H3&gt;//CancelCommand&lt;/H3&gt;
&lt;FONT color=#0000ff size=2&gt;protected&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; DataList1_CancelCommand(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;object&lt;/FONT&gt;&lt;FONT size=2&gt; source, &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;DataListCommandEventArgs&lt;/FONT&gt;&lt;FONT size=2&gt; e)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;DataList1.EditItemIndex = -1;&lt;/P&gt;&lt;P&gt;DataList1.DataBind();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;
&lt;H3&gt;//DeleteCommand&lt;/H3&gt;
&lt;FONT color=#0000ff size=2&gt;protected&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; DataList1_DeleteCommand(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;object&lt;/FONT&gt;&lt;FONT size=2&gt; source, &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;DataListCommandEventArgs&lt;/FONT&gt;&lt;FONT size=2&gt; e)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt; (e.CommandName == &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"DELETE"&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; sId = DataList1.DataKeys[e.Item.ItemIndex].ToString();&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;BlogManager&lt;/FONT&gt;&lt;FONT size=2&gt;.DeleteBlogCategory(&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Convert&lt;/FONT&gt;&lt;FONT size=2&gt;.ToInt32(sId));&lt;/P&gt;&lt;P&gt;DataList1.DataBind();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;
&lt;H3&gt;//ItemCommand&lt;/H3&gt;
&lt;FONT color=#0000ff size=2&gt;protected&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; DataList1_ItemCommand(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;object&lt;/FONT&gt;&lt;FONT size=2&gt; source, &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;DataListCommandEventArgs&lt;/FONT&gt;&lt;FONT size=2&gt; e)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt; (e.CommandName == &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"ADDNEW"&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; sDesc = ((&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;TextBox&lt;/FONT&gt;&lt;FONT size=2&gt;)e.Item.FindControl(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"txtCategoryDesc"&lt;/FONT&gt;&lt;FONT size=2&gt;)).Text;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;BlogCategory&lt;/FONT&gt;&lt;FONT size=2&gt; objBlogCategory = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;BlogCategory&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;/P&gt;&lt;P&gt;objBlogCategory.Description = sDesc;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;BlogManager&lt;/FONT&gt;&lt;FONT size=2&gt;.AddBlogCategory(objBlogCategory);&lt;/P&gt;&lt;P&gt;DataList1.DataBind();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/FONT&gt;
&lt;/PRE&gt;
&lt;H2&gt;How it works?&lt;/H2&gt;
&lt;P&gt;The event model is pretty straight forward, we set the EditItemIndex to the row index that needs to be edited, this is provided to us by the DataList control so there is no complexity.&lt;/P&gt;
&lt;P&gt;During update the update command event is fired and we get the blog category description from the TextBox that holds the data by using the FindControl method.&lt;/P&gt;
&lt;P&gt;Delete is very simple one just use the DataKeys collection of DataList and get the category id to delete. &lt;/P&gt;
&lt;P&gt;Adding of new category seems to follow the same pattern and since this operation doesn't have a specific event associated to it we use the ItemCommand event to meet our objective. &lt;/P&gt;
&lt;H2&gt;Final output&lt;/H2&gt;
&lt;P&gt;Below given snapshot is the final output to manage our blog category, pretty neat and clean is it :) &lt;/P&gt;
&lt;IMG src="/ScreenShots/DataList_InAction_WebPage.JPG" border="0" /&gt;
&lt;P&gt;Once you catch hold of the DataList control and play around you will find the control very usefull and a powerfull tool. &lt;/P&gt;&lt;/LI&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=54" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry><entry><title>System.Net.Mail - How to add Alternate views and Embed Images</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/07/23/System_Net_Mail_AlternateView_LinkedResource.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/07/23/System_Net_Mail_AlternateView_LinkedResource.aspx</id><published>2006-07-23T20:05:00Z</published><updated>2006-07-23T20:05:00Z</updated><content type="html">&lt;p&gt;
System.Net.Mail provides us with a very intuitive object model to construct and send an email message.
&lt;/p&gt; 
 
&lt;p&gt;
These days almost all the web and windows email clients gives us more control over the email content we wish to view (a.k.a HTML view, plain text view). 
This is  to make us aware that the email content we are viewing may contain explicit images or externally linked images. 
Now imagine the recipient have disabled HTML content in his/her settings then the email content will be displayed as is(with HTML tags).
&lt;/p&gt;  

&lt;p&gt;
We definitely don't want garbled text to be viewed by the recipient, now here is where the Alternate view comes to our rescue. 
As the name suggests it allows us to add alternate content that can be viewed by the receipient in case HTML content is disabled in his/her settings.
&lt;/p&gt;  

&lt;p&gt;
Similarly many web/windows email clients disable external images in the mail message to avoid linking of external images we can use the LinkedResource to embed images in our email message.
&lt;/p&gt;  

&lt;p&gt;
Although the core topic is about adding alternate views and embedding resources(images, etc) to an email, I will also touch upon configuration settings in web.config and Network Credentials.
&lt;/p&gt;  

&lt;p&gt;&lt;strong&gt;MailMessage&lt;/strong&gt;:
&lt;/p&gt;

&lt;p&gt;
The MailMessage class plays a key role by wrapping all the email details like
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;From address   &lt;/li&gt;
&lt;li&gt;To address (collection)   &lt;/li&gt;
&lt;li&gt;CC address (collection)   &lt;/li&gt;
&lt;li&gt;BCC address (collection)   &lt;/li&gt;
&lt;li&gt;Email Subject   &lt;/li&gt;
&lt;li&gt;Email Body   &lt;/li&gt;
&lt;li&gt;Priority   &lt;/li&gt;
&lt;li&gt;Delivery notification options   &lt;/li&gt;
&lt;li&gt;Alternate views (Plain text, HTML)   &lt;/li&gt;
&lt;li&gt;Linked Resources (images, etc)&lt;/li&gt;
&lt;/ul&gt; 

&lt;p&gt;Below given is a typical code used to send an email, the code is pretty straight forward apart from the AlternateViews, LinkedResources and some SMTPClient config section.
&lt;/p&gt;
&lt;pre&gt;//========================================================  &lt;br&gt;MailMessage objMailMessage = new MailMessage();&lt;br&gt;&lt;br&gt;//File Attachment&lt;br&gt;if (fileUploadEmailAttachment.HasFile)&lt;br&gt;{&lt;br&gt;  objMailMessage.Attachments.Add(&lt;br&gt;  		new Attachment(&lt;br&gt;		fileUploadEmailAttachment.FileContent, &lt;br&gt;		fileUploadEmailAttachment.FileName));&lt;br&gt;&lt;br&gt;}&lt;br&gt;		&lt;br&gt;//From&lt;br&gt;objMailMessage.From = new MailAddress(txtEmailFrom.Text, &lt;br&gt;				txtDisplayName.Text);&lt;br&gt;		&lt;br&gt;//To&lt;br&gt;objMailMessage.To.Add(new MailAddress(txtEmailTo.Text));&lt;br&gt;	&lt;br&gt;//CC&lt;br&gt;if (txtEmailCC.Text.Length &gt; 0)&lt;br&gt;{&lt;br&gt; objMailMessage.CC.Add(new MailAddress(txtEmailCC.Text));&lt;br&gt;}&lt;br&gt;	&lt;br&gt;//BCC	&lt;br&gt;if (txtEmailBCC.Text.Length &gt; 0)&lt;br&gt;{&lt;br&gt; objMailMessage.Bcc.Add(new MailAddress(txtEmailBCC.Text));&lt;br&gt;}&lt;br&gt;	&lt;br&gt;//Subject&lt;br&gt;objMailMessage.Subject = txtSubject.Text;&lt;br&gt;	&lt;br&gt;//Plain Text Alternative Email Content &lt;br&gt;AlternateView objPlainAltView = AlternateView.CreateAlternateViewFromString(&lt;br&gt;					txtAlternateView.Text);&lt;br&gt;objMailMessage.AlternateViews.Add(objPlainAltView);&lt;br&gt;	&lt;br&gt;//HTML Alternative Email Content&lt;br&gt;LinkedResource objLinkedRes = new LinkedResource(&lt;br&gt;			Server.MapPath(".") &lt;br&gt;			+ "\\fuzzydev-logo.jpg", "image/jpeg");&lt;br&gt;objLinkedRes.ContentId = "fuzzydev-logo"; &lt;br&gt;	&lt;br&gt;AlternateView objHTLMAltView = AlternateView.CreateAlternateViewFromString(&lt;br&gt;				txtHTMLBody.Text, &lt;br&gt;				new System.Net.Mime.ContentType("text/html"));&lt;br&gt;	&lt;br&gt;objHTLMAltView.LinkedResources.Add(objLinkedRes);&lt;br&gt;objMailMessage.AlternateViews.Add(objHTLMAltView);&lt;br&gt;	&lt;br&gt;//High Priority&lt;br&gt;objMailMessage.Priority = MailPriority.High;&lt;br&gt;	&lt;br&gt;//Notify On Sucessfull Delivery&lt;br&gt;objMailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnSuccess;&lt;br&gt;SmtpClient objSMTPClient = new SmtpClient(txtHostName.Text);&lt;br&gt;objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.Network;&lt;br&gt;	&lt;br&gt;if(chkBoxEnableSSL.Checked)&lt;br&gt;  objSMTPClient.EnableSsl = true;&lt;br&gt;		&lt;br&gt;//Credentials (username, password)&lt;br&gt;string sUserName = txtEmailFrom.Text.Split('@')[0];&lt;br&gt;objSMTPClient.Credentials = new System.Net.NetworkCredential(&lt;br&gt;			sUserName, txtEmailFromPassword.Text);&lt;br&gt;	&lt;br&gt;//Send Email&lt;br&gt;objSMTPClient.Send(objMailMessage);&lt;br&gt;	&lt;br&gt;//========================================================&lt;br&gt;&lt;/pre&gt;  

&lt;p&gt;Now let me concentrate on the Alternateview, adding an alternate view is very easy, just create an object of the AlternateView class using the static method of the &lt;strong&gt;AlternateView&lt;/strong&gt; class called &lt;strong&gt;CreateAlternateViewFromString&lt;/strong&gt; passing the email text and the MIME type.
&lt;/p&gt;  

&lt;p&gt;&lt;strong&gt;For example if we want to create a plain text view then we will do something like this&lt;/strong&gt;
&lt;/p&gt;  

&lt;pre&gt;AlternateView objPlainAltView = AlternateView .CreateAlternateViewFromString(&lt;br&gt;					txtAlternateView.Text);&lt;br&gt;objMailMessage.AlternateViews.Add(objPlainAltView);&lt;br&gt;&lt;/pre&gt;  

&lt;p&gt;&lt;strong&gt;Now if we need HTML view then&lt;/strong&gt;
&lt;/p&gt;  

&lt;pre&gt;AlternateView objHTLMAltView = AlternateView.CreateAlternateViewFromString(&lt;br&gt;				txtHTMLBody.Text, &lt;br&gt;				new System.Net.Mime.ContentType("text/html"));&lt;br&gt;objMailMessage.AlternateViews.Add(objHTLMAltView);&lt;br&gt;&lt;/pre&gt;  

&lt;p&gt;
That looks pretty simple, now the good news is the recipient will view the email message based on the email clients settings. 
So if HTML content is disabled then plain text message is displayed otherwise the HTML content is displayed.
&lt;/p&gt; 

&lt;p&gt;Let us move forward and get our hands dirty by embedding an image in an HTML content message. 
In order to embed an image in our email we can use LinkedResource class, we can add this object to the LinkedResource collection of the AlternateView object.
&lt;/p&gt;  

&lt;pre&gt;LinkedResource objLinkedRes = new LinkedResource(&lt;br&gt;				Server.MapPath(".") &lt;br&gt;				+ "\\fuzzydev-logo.jpg", &lt;br&gt;				"image/jpeg");&lt;br&gt;objLinkedRes.ContentId = "fuzzydev-logo"; &lt;br&gt;	&lt;br&gt;AlternateView objHTLMAltView = AlternateView.CreateAlternateViewFromString(&lt;br&gt;				"&lt;img /&gt;", &lt;br&gt;				new System.Net.Mime.ContentType("text/html"));&lt;br&gt;objHTLMAltView.LinkedResources.Add(objLinkedRes);&lt;br&gt;objMailMessage.AlternateViews.Add(objHTLMAltView);&lt;br&gt;&lt;br&gt;&lt;/pre&gt;  

&lt;p&gt;
In the above code we are passing an image file path and also specifying the content type as an jpeg image to the LinkedResource object. 
Next line of code is very interesting, we are assigning a unique ContentId which will be used to set the src of our HTML image tag. 
In our case the content id is fuzzydev-logo and if you look at the HTML alternate view object in the constructor section we are having an image tag which refers to the same content id.
&lt;/p&gt;  

&lt;p&gt;
Now it's the email clients responsibility to understand the embedded resource and the reference in the image tag and display the image.
&lt;/p&gt;  

&lt;p&gt;&lt;strong&gt;SMTPClient:&lt;/strong&gt;&lt;/p&gt;  

&lt;p&gt;Now coming to the SMTP client configuration, let's just look in to what is the minimum configuration settings that SMTP client object expects from us.
&lt;/p&gt;  

&lt;ul&gt;  
&lt;li&gt;Host name or IP address   &lt;/li&gt;
&lt;li&gt;Delivery Method (Network, Pick up directory from IIS, custom  pickup directory)   &lt;/li&gt;
&lt;li&gt;EnableSsl (whether Secured Socket Layer is required)   &lt;/li&gt;
&lt;li&gt;Credentials (user name, password)&lt;/li&gt;
&lt;/ul&gt;  

&lt;p&gt;&lt;strong&gt;SMTPClient configuration in web.config:&lt;/strong&gt;&lt;/p&gt;  

&lt;pre&gt;	&lt;br&gt;	&lt;br&gt;	&lt;br&gt;	&lt;br&gt;	&lt;br&gt;		userName="email user name" &lt;br&gt;		password="email passowrd" &lt;br&gt;	/&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;/pre&gt;

&lt;p&gt;
The above configuration helps us in quickly changing the delivery method, from mail address, host name (or IP address) , user name and password. 
Although the configuration is not mandatory it is the recommended way of implementing the email functionality.
&lt;/p&gt; 

&lt;p&gt;Below given code doesn't depend on the web.config for it's configuration needs&lt;/p&gt;  

&lt;pre&gt;	SmtpClient objSMTPClient = new SmtpClient(txtHostName.Text);&lt;br&gt;	objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.Network;&lt;br&gt;	if(chkBoxEnableSSL.Checked)&lt;br&gt;		objSMTPClient.EnableSsl = true;&lt;br&gt;		&lt;br&gt;	//Credentials (username, password)&lt;br&gt;	string sUserName = txtEmailFrom.Text.Split('@')[0];&lt;br&gt;	objSMTPClient.Credentials = new System.Net.NetworkCredential(&lt;br&gt;				sUserName, txtEmailFromPassword.Text);&lt;br&gt;	&lt;br&gt;	//Send Email  &lt;br&gt;	objSMTPClient.Send(objMailMessage);&lt;br&gt;	&lt;br&gt;&lt;/pre&gt;	
	
&lt;p&gt;
We don't need to specify the host name, etc if it's available in the web.config, this is usefull as in different part's of our application we can just use the specified configuration and if required then specify manually.
&lt;/p&gt;  

&lt;p&gt;
Now that deserves a round applause for those involved in the development of System.Net.Mail classes.
&lt;/p&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=44" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry><entry><title>.Net Profile Object &amp;quot;my customers, my ambassadors&amp;quot; - Part 2</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/07/01/Story_Of_Profiling_Part2.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/07/01/Story_Of_Profiling_Part2.aspx</id><published>2006-06-30T22:11:00Z</published><updated>2006-06-30T22:11:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial&gt;For those who haven't read my previous posting on ASP.Net profile object (&lt;A href="/blogs/dotnet/archive/2006/06/17/Story_Of_Profiling.aspx"&gt;.Net Profile Object "my customers, my ambassadors"&lt;/A&gt;) can read &lt;A href="/blogs/dotnet/archive/2006/06/17/Story_Of_Profiling.aspx"&gt;here&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;This has been long overdue I couldn't post sequel as I was held up with other commitments.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Anyway, let's kick start the Story Of Profiling part 2.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;To be short and sweet, a good website should remember my preferrences. So that the next time I visit , I get a personalized welcome.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;&lt;U&gt;So how do we achieve this without using the out of the box solution provided by ASP.Net 2.0?&lt;/U&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial&gt;Create couple of tables and stored procedures to store and manipulate user profile details.&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial&gt;Write few classes' which will hold user's preferrence.&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial&gt;Write data access code to store and retrieve user's preferrence.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;That's not much work and we can very well go ahead and develop our own personalization framework.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;&lt;U&gt;What does ASP.Net 2.0 provide?&lt;/U&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;It not only provides us with predefined set of tables, stored procedures and classes but like all other new features it's using provider model and so customization is not a painfull task. Provider model is the best thing that has happened to ASP.Net as it allows us to plug and play the implementations, this is acieved with the mixture of configuration settings and judicious use of reflection.&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Arial&gt;
&lt;P&gt;Let's dive in to the code and config settings to implement personalization.&lt;/P&gt;
&lt;P&gt;Before we get our hands dirty with any code let's just set the required configuration. Below given is the sample profile properties.&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#006400&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#006400&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#006400&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The green colored config section is specific to profile. Although the elements are self describing let me explain the elements and it's attributes. By adding these elements and attributes we are asking the IDE and ASP.Net to recognize these properties as part of the profile object exposed in our Page class.&lt;/P&gt;
&lt;P&gt;So in the above scenario our profile object will have properties like DisplayName, ShowOnlineStatus which is of type boolean and also we are asking to group PageTheme and EmailArticles inside UserInterface. So the final profile object will have the below given structure&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#006400&gt;Page.Profile.DisplayName                           = "Sachin Joshi";&lt;BR&gt;Page.Profile.ShowOnlineStatus                   = true;&lt;BR&gt;Page.Profile.UserInterface.PageTheme     = "Blue";&lt;BR&gt;Page.Profile.UserInterface.EmailArticles    = false;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;But hold a second, how did our profile object in our page got to know about the configuration and exposed these strongly-typed properties. It's not magic but the ASP.Net parser have recognized the profile configuration and have generated a class called ProfileCommon inherited from ProfileBase and have exposed the configured properties. Just check your App_Code folder and you will find a class called ProfileCommon inherited from ProfileBase.&lt;/P&gt;
&lt;P&gt;So far so good, we have created a very simple configuration for personalization and in our web pages we will give our users  the ability to save these details. But the question here is where exactly these details are saved.&lt;/P&gt;
&lt;P&gt;Actually we have not yet configured any profile provider which helps us in storage and retrieval of these customized profile. SqlProfileProvider comes to our rescue, this class is part of the ASP.Net 2.0 framework and as the name suggests it stores and retrieves profile data to and from Sql Server. &lt;/P&gt;
&lt;P&gt;Below given is the sample configuration of profile provider.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#006400&gt;&lt;BR&gt;  &lt;BR&gt;    &lt;BR&gt;         connectionStringName="SqlServer2005" &lt;BR&gt;         applicationName="/" &lt;BR&gt;         type="System.Web.Profile.SqlProfileProvider" /&gt;&lt;BR&gt;  &lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;In the above config we are asking ASP.Net to use the connection string from the specified section and use the SqlProfileProvider. So when we use the profile object ASP.Net in turn will be responsible to create an instance of the right provider and use the provider to store and retrieve the profile data.&lt;/P&gt;
&lt;P&gt;Below is the final configuration we will end up with to acieve the objective.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR&gt;&lt;FONT color=#000080&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000080&gt;&lt;BR&gt;name="SqlServer2005" &lt;BR&gt;connectionString="server=SOME_SERVER;database=SOME_DB;uid=XXXXXX;pwd=XXXXXX;"&lt;BR&gt;/&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000080&gt;&lt;BR&gt;name="MYSql" &lt;BR&gt;connectionString="server=SOME_SERVER;database=SOME_DB;uid=XXXXXX;pwd=XXXXXX;"&lt;BR&gt;/&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000080&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;FONT color=#006400&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/STRONG&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;&lt;EM&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR&gt;&lt;FONT color=#a52a2a&gt;  &lt;BR&gt;    &lt;BR&gt;         connectionStringName="SqlServer2005" &lt;BR&gt;         applicationName="/" &lt;BR&gt;         type="System.Web.Profile.SqlProfileProvider" /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#a52a2a&gt;    &lt;BR&gt;         connectionStringName="MySql" &lt;BR&gt;         applicationName="/" &lt;BR&gt;         type="fuzzydev.Providers.MySqlProfileProvider" /&gt;&lt;BR&gt;  &lt;BR&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;BR&gt;&lt;/EM&gt;&lt;/STRONG&gt;  &lt;BR&gt;&lt;FONT color=#006400&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Note that in the above configuration there are two connection strings, one pointing to Sql Server and the other to MySql. Similarly there are two providers one for each DBMS, now we can switch to any provider by changing the defaultProvider attribute in the providers section.&lt;/P&gt;
&lt;P&gt;Our UI need not worry about which provider or dbms is being used, this is made possible with combination of polymorphism, configuration and reflection.&lt;/P&gt;
&lt;P&gt;Before you start playing with it there are couple of things which would be helpfull.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Serialization&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P dir=ltr&gt;          By default all the primitive types are serialized as string, this can be&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P dir=ltr&gt;overriden by specifying the &lt;STRONG&gt;serializeAs&lt;/STRONG&gt; attribute in the configuration&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT color=#006400&gt;&lt;STRONG&gt;serializeAs="Binary"&lt;/STRONG&gt; /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT color=#000000&gt;or&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT color=#006400&gt;&lt;STRONG&gt;serializeAs="Xml"&lt;/STRONG&gt; /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT color=#000000&gt;&lt;STRONG&gt;Allow Profiling For Anonymous Users&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P&gt;Profiling can also be done for anonymous users we just need to specify&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;allowAnonymous="true"&lt;/STRONG&gt; in the configuration.&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#006400&gt;&lt;STRONG&gt;serializeAs="Xml"&lt;/STRONG&gt; /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000000&gt;Anonymous users are tracked using cookies, this discussion will require a&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;whole new blog entry and so further details are deferred.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;This is just a brief introduction of ASP.Net profiling, there are lot of things which needs to be looked in to like &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Writing our own custom profile class by inheriting from ProfileBase and setting the attributes like allowAnonymous, serializeAs to the properties. 
&lt;LI&gt;Writing our own profile provider for our custom data store for example Xml, Access, etc. 
&lt;LI&gt;Migration of saved preferrences of anonymous users when they are promoted to registered users.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;ASP.Net profiling is a great way of adding richness to your website with the simplicity and flexibility of plug and play components.&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=32" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry><entry><title>Excellent resource on 3-tiered data architecture with ASP.NET 2.0</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/25/three_tiered_data_architecture_with_ASPNET2.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/25/three_tiered_data_architecture_with_ASPNET2.aspx</id><published>2006-06-25T12:10:00Z</published><updated>2006-06-25T12:10:00Z</updated><content type="html">&lt;P&gt;&lt;A href="http://www.scottonwriting.net/sowBlog/"&gt;&lt;FONT face=Arial size=2&gt;Scott Mitchell&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt; has put together an awesome tutorial on building and using 3-tiered date architecture  with ASP.Net 2.0&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;It's available &lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/default.aspx?tabid=63"&gt;&lt;FONT face=Arial&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The flow of the tutorial is excellent, you can also download the tutorials in pdf format.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;C# Tutorial in PDF format is available at &lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/datatutorials1_10cs.zip"&gt;&lt;FONT face=Arial&gt;http://www.asp.net/learn/dataaccess/datatutorials1_10cs.zip&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial&gt; and &lt;/FONT&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/datatutorials11_15cs.zip"&gt;&lt;FONT face=Arial&gt;http://www.asp.net/learn/dataaccess/datatutorials11_15cs.zip&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;VB.Net Tutorial in PDF format is available at &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;A href="http://www.asp.net/learn/dataaccess/datatutorials1_10vb.zip"&gt;http://www.asp.net/learn/dataaccess/datatutorials1_10vb.zip&lt;/A&gt; and &lt;/FONT&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/datatutorials11_15vb.zip"&gt;&lt;FONT face=Arial&gt;http://www.asp.net/learn/dataaccess/datatutorials11_15vb.zip&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;If you want to kick start directly to a specific topic, I have listed down the different topics and the corresponding links for tutorial and source code for both C# and VB.Net.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.asp.net/learn/dataaccess/default.aspx?tabid=63#intro"&gt;&lt;STRONG&gt;&lt;FONT face=Arial color=#006400 size=5&gt;Introduction&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;&lt;FONT color=#000000&gt;1. Creating a Data Access Layer&lt;/FONT&gt;&lt;/STRONG&gt;  &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;View this tutorial at&lt;/EM&gt; &lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial01cs.aspx?tabid=63"&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial01vb.aspx?tabid=63"&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;Download source code&lt;/EM&gt;: &lt;/FONT&gt;&lt;A href="http://download.microsoft.com/download/4/6/3/463cf87c-4724-4cbc-b7b5-3f866f43ba50/ASPNET_Data_Tutorial_1_CS.exe"&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;A href="http://download.microsoft.com/download/5/d/7/5d7571fc-d0b7-4798-ad4a-c976c02363ce/ASPNET_Data_Tutorial_1_VB.exe"&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;2. Creating a Business Logic Layer&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;View this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial02cs.aspx?tabid=63"&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;C#&lt;/EM&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial02vb.aspx?tabid=63"&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;VB.Net&lt;/EM&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;Download source code: &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://download.microsoft.com/download/4/6/3/463cf87c-4724-4cbc-b7b5-3f866f43ba50/ASPNET_Data_Tutorial_2_CS.exe"&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;C#&lt;/EM&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://download.microsoft.com/download/5/d/7/5d7571fc-d0b7-4798-ad4a-c976c02363ce/ASPNET_Data_Tutorial_2_VB.exe"&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;VB.Net&lt;/EM&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;&lt;EM&gt;3. Master Pages and Site &lt;/EM&gt;&lt;/STRONG&gt;Navigation&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;View&lt;EM&gt; this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial03cs.aspx?tabid=63"&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;C#&lt;/EM&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial03vb.aspx?tabid=63"&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;VB.Net&lt;/EM&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;Download source code: &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://download.microsoft.com/download/4/6/3/463cf87c-4724-4cbc-b7b5-3f866f43ba50/ASPNET_Data_Tutorial_3_CS.exe"&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;C#&lt;/EM&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://download.microsoft.com/download/5/d/7/5d7571fc-d0b7-4798-ad4a-c976c02363ce/ASPNET_Data_Tutorial_3_VB.exe"&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;VB.Net&lt;/EM&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;A href="http://www.asp.net/learn/dataaccess/default.aspx?tabid=63#intro"&gt;&lt;FONT face=Arial color=#006400 size=5&gt;&lt;STRONG&gt;Basic Reporting&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;1. Displaying Data With the ObjectDataSource&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;View&lt;EM&gt; this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial04cs.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial04vb.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Download source code: &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/4/6/3/463cf87c-4724-4cbc-b7b5-3f866f43ba50/ASPNET_Data_Tutorial_4_CS.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/5/d/7/5d7571fc-d0b7-4798-ad4a-c976c02363ce/ASPNET_Data_Tutorial_4_VB.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;2. Declarative Parameters&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;View&lt;EM&gt; this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial05cs.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial05vb.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Download source code: &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/4/6/3/463cf87c-4724-4cbc-b7b5-3f866f43ba50/ASPNET_Data_Tutorial_5_CS.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/5/d/7/5d7571fc-d0b7-4798-ad4a-c976c02363ce/ASPNET_Data_Tutorial_5_VB.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;3. Programmatically Setting the ObjectDataSource's Parameter Values&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;View&lt;EM&gt; this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial06cs.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial06vb.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Download source code: &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/4/6/3/463cf87c-4724-4cbc-b7b5-3f866f43ba50/ASPNET_Data_Tutorial_6_CS.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/5/d/7/5d7571fc-d0b7-4798-ad4a-c976c02363ce/ASPNET_Data_Tutorial_6_VB.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#006400 size=5&gt;&lt;STRONG&gt;&lt;U&gt;Master/Detail Reporting&lt;/U&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/default.aspx?tabid=63#intro"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;1. Master/Detail Filtering With a DropDownList&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;View&lt;EM&gt; this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial07cs.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial07vb.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Download source code: &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/4/6/3/463cf87c-4724-4cbc-b7b5-3f866f43ba50/ASPNET_Data_Tutorial_7_CS.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/5/d/7/5d7571fc-d0b7-4798-ad4a-c976c02363ce/ASPNET_Data_Tutorial_7_VB.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;2. Master/Detail Filtering With Two DropDownLists&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;View&lt;EM&gt; this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial08cs.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial08vb.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Download source code: &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/4/6/3/463cf87c-4724-4cbc-b7b5-3f866f43ba50/ASPNET_Data_Tutorial_8_CS.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/5/d/7/5d7571fc-d0b7-4798-ad4a-c976c02363ce/ASPNET_Data_Tutorial_8_VB.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;3. Master/Detail Filtering Across Two Pages&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;View&lt;EM&gt; this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial09cs.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial09vb.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Download source code: &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/4/6/3/463cf87c-4724-4cbc-b7b5-3f866f43ba50/ASPNET_Data_Tutorial_9_CS.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/5/d/7/5d7571fc-d0b7-4798-ad4a-c976c02363ce/ASPNET_Data_Tutorial_9_VB.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;4. Master/Detail Using a Selectable Master GridView with a Details DetailView&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;View&lt;EM&gt; this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial10cs.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial10vb.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Download source code: &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/4/6/3/463cf87c-4724-4cbc-b7b5-3f866f43ba50/ASPNET_Data_Tutorial_10_CS.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/5/d/7/5d7571fc-d0b7-4798-ad4a-c976c02363ce/ASPNET_Data_Tutorial_10_VB.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;FONT face=Arial color=#006400 size=5&gt;Custom formatting&lt;/FONT&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;1. Custom Formatting Based Upon Data&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;View&lt;EM&gt; this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial11cs.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial11vb.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Download source code: &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/9/6/9/969e5c94-dfb6-4e47-9570-d6d9e704c3c1/ASPNET_Data_Tutorial_11_CS.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/5/7/0/57084608-dfb3-4781-991c-407d086e2adc/ASPNET_Data_Tutorial_11_VB.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;2. Using TemplateFields in the GridView Control&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;View&lt;EM&gt; this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial12cs.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial12vb.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Download source code: &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/9/6/9/969e5c94-dfb6-4e47-9570-d6d9e704c3c1/ASPNET_Data_Tutorial_12_CS.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/5/7/0/57084608-dfb3-4781-991c-407d086e2adc/ASPNET_Data_Tutorial_12_VB.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;3. Using TemplateFields in the DetailsView Control&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;View&lt;EM&gt; this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial13cs.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial13vb.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Download source code: &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/9/6/9/969e5c94-dfb6-4e47-9570-d6d9e704c3c1/ASPNET_Data_Tutorial_13_CS.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/5/7/0/57084608-dfb3-4781-991c-407d086e2adc/ASPNET_Data_Tutorial_13_VB.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;4. Using the FormView's Templates&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;View&lt;EM&gt; this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial14cs.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial14vb.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Download source code: &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/9/6/9/969e5c94-dfb6-4e47-9570-d6d9e704c3c1/ASPNET_Data_Tutorial_14_CS.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/5/7/0/57084608-dfb3-4781-991c-407d086e2adc/ASPNET_Data_Tutorial_14_VB.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;5. Displaying Summary Information in the GridView's Footer&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;View&lt;EM&gt; this tutorial at &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial15cs.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://www.asp.net/learn/dataaccess/tutorial15vb.aspx?tabid=63"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Download source code: &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/9/6/9/969e5c94-dfb6-4e47-9570-d6d9e704c3c1/ASPNET_Data_Tutorial_15_CS.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;C#&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;FONT face=Arial&gt; &lt;/FONT&gt;&lt;/EM&gt;&lt;A href="http://download.microsoft.com/download/5/7/0/57084608-dfb3-4781-991c-407d086e2adc/ASPNET_Data_Tutorial_15_VB.exe"&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;VB.Net&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Scott Mitchell blogs &lt;A href="http://www.scottonwriting.net/sowBlog/"&gt;here&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Excellent work Scott, the tutorial is very usefull and interesting as well.  &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;FONT color=#0000ff&gt;&lt;A href="http://technorati.com/claim/iyy5ap5u5" rel=me&gt;&lt;FONT face=Arial&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;/U&gt; &lt;/P&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=30" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry><entry><title>.Net Profile Object  &amp;quot;my customers, my ambassadors&amp;quot;</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/17/Story_Of_Profiling.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/17/Story_Of_Profiling.aspx</id><published>2006-06-17T02:36:00Z</published><updated>2006-06-17T02:36:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial&gt;At first it might look irrelevant and you might ask "What has .Net Profile to do with my optical business?", just  sit back, relax and read on as it will be evident that it is relevant.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Around 5 years back while I was pursuing my graduation degree, I opened an optical showroom, it was one heck of time to juggle between college and look after the business. Yet somehow I managed it, this log is not about how professionally/successfully &lt;img src="/emoticons/emotion-4.gif" alt="Stick out tongue [:P]" /&gt; I managed my business; but it's about what I learnt out of it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;While I was busy with my college I used to spent lot of time thinking of different strategies to develop my business. D&lt;/FONT&gt;&lt;FONT face=Arial&gt;uring the second year out of the blue many such showrooms started to pop up and there was tough competition, people started slashing their prices of spectacles and the business started to soar. Now the business was evenly divided among the showrooms.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Many showroom owners came up with special discounts, spent lavishly on promotion and started to attract more customers. Some showrooms roped in professional advertising agency with good models to be their ambassador. All this made me insecure and due to capital constraints we were not spending on advertisements and had to rethink our business strategy.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;As I was pursuing Bachelor's of Business Administration I had the knowledge on marketing management and came up with a great idea which really worked.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Before I talk about it, let me put forth few questions to you.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;Q. To impress a girl what do you do?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;A. You try to know what she likes and gift her.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;Q. To impress an HR what do you speak?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;A. You speak what he wants to listen to&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Do you see a pattern and something hidden in the above answers, well in order to impress a girl or HR you need to know what they like and so you need to collect information about their likes and dislikes  and use that information to your advantage.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;That's what I did; I started collecting information about my customers. Every time I got a new customer I collected their address, phone number, date of birth, anniversaries, etc. So how do collecting customer information improve my business, key here is what you do with that information. I used that data to analyze and send mails to remind them of regular eye check-up, special discounts for being our customer, wishing them on their birthday, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Also it was not just about collecting info in a diary but even my mind was collecting data like storing customers image and recognizing and greeting them with their name when they pay their next visit.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Don't you feel good when you visit a coffee pub and the waiter or manager smiles at you and greets you with your name as if indirectly telling you "I know you, you are my valuable customer", especially when you are with your friends/GF &lt;img src="/emoticons/emotion-5.gif" alt="Wink [;)]" /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;These little gestures proved to be steroids to my business and the business started to boom again; the new customers were actually my old customers relatives, friends, neighbors, etc. So I made "&lt;STRONG&gt;my customers, my ambassadors&lt;/STRONG&gt;" note the quote my dear marketing guys you won't find this in any books or research papers. My customers were marketing for me and my business was back into action.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Little did I know after around 5 years I will be doing this again, but this time I am not going to collect the information one-on-one but through the Profile object provided by .Net.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Huh...you will be thinking at last this guy is talking about Profile object.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Read &lt;A href="/blogs/dotnet/archive/2006/07/01/Story_Of_Profiling_Part2.aspx"&gt;Story of Profiling part 2&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;/FONT&gt; &lt;/P&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=28" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry><entry><title>Tech.Ed 2006 - for geeks in Chennai</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/10/TechEd_2006_for_geeks_in_Chennai.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/10/TechEd_2006_for_geeks_in_Chennai.aspx</id><published>2006-06-10T18:13:00Z</published><updated>2006-06-10T18:13:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial&gt;Tech.Ed 2006 in Chennai will be held at Chennai Trade Centre and kick starts on 15th June and will end with a bang(entertainment/party) on 17th June.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;Where is Chennai Trade Centre?&lt;/STRONG&gt;&lt;BR&gt;Chennai Trade Centre&lt;BR&gt;Mount Poonamallee High Road&lt;BR&gt;Nandambakkam &lt;BR&gt;Chennai: 600089 &lt;BR&gt;Ph: 91-44-22316033, 22315551 &lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Map of Chennai Trade Centre is available at &lt;A href="http://www.indiasoft.ind.in/venue_map.htm"&gt;http://www.indiasoft.ind.in/venue_map.htm&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Complete details of all the session is available at &lt;A href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032295913&amp;Culture=en-IN"&gt;http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032295913&amp;Culture=en-IN&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Visit &lt;A href="http://forums.techedindia.com/"&gt;http://forums.techedindia.com/&lt;/A&gt; a forum started by MVP's to answer all your developer and IT Pro related questions. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Visit &lt;A href="http://spaces.msn.com/vineetgupta/"&gt;http://spaces.msn.com/vineetgupta/&lt;/A&gt; and know what Vineet Gupta is cooking for the TechEd sessions. He is loaded with and willing to share his wisdom on Data Platform and Architecture tracks.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=10" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry><entry><title>Operation could destabilize the runtime</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/10/Operation_could_destabilize_the_runtime.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/10/Operation_could_destabilize_the_runtime.aspx</id><published>2006-06-10T09:39:00Z</published><updated>2006-06-10T09:39:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial&gt;Hmm "&lt;FONT color=#ff0000&gt;Operation could destabilize the runtime&lt;/FONT&gt;" sounds too scary, what operation on earth is this; which can destabilize the .Net runtime?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;It looks like  the 1.1 C#/VB.Net compiler had case boundary with the generated IL code, the massive overhaul done for the new features in 2.0 forced some low level code changes in CLR; this in turn is haunting few 1.1 assemblies.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;One of the well known case is the switch statement having more than 8 conditions. If you try to use 1.1 assembly having a code block of switch statement exceeding 8 conditions then you might face the horrifying exceptions like...&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;System.Exceptions.PageLoadException&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;System.Security.VerificationException&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Try changing the switch case to if..else condition that will solve the problem.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;For more details check the below given link&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.asp.net/thread/1255521.aspx"&gt;http://forums.asp.net/thread/1255521.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=7" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry><entry><title>Date with DataSource Control - Ms. ObjectDataSource</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/10/DateWithObjectDataSource.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/10/DateWithObjectDataSource.aspx</id><published>2006-06-10T09:10:00Z</published><updated>2006-06-10T09:10:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial&gt;Developer's are the most busiest guys on the earth and unfortunately I am one of them. So what do we do about it? Well, I have decided to go out on date with the five beautifull girls. Their names are listed below.&lt;/FONT&gt; &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial&gt;Ms. ObjectDataSource &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial&gt;Ms. SqlDataSource &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial&gt;Ms. AccessDataSource &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial&gt;Ms. XmlDataSource &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial&gt;Ms. SiteMapDataSource&lt;/FONT&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;So let me start with Ms. ObjectDataSource...&lt;/FONT&gt; &lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;Where can we find her?&lt;/STRONG&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;She hangs out almost everyday in the data tab of the VS IDE toolbox. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;What's her nature of job?&lt;/STRONG&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;She works for a framework called .Net 2.0 and is a thorough professional providing data for all the data bound controls. She is a very smart lady, she is aware of the fact that enterprise applications market is a multi billion dollar industry and many developers these days are part of this industry. If the application is not scalable then the industry doesn't have a chance to survive. She allows developers to use the data source controls yet have the abstraction layer intact. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;How does she deliver her role? &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;I remember once she told me that she is been entrusted with this responsibility and going to seek help from her close friend (her name is Ms. Reflection stays in System). &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Discussion about reflection is deferred until I go out on date with all the Ms. Datasource's &lt;img src="/emoticons/emotion-5.gif" alt="Wink [;)]" /&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Well back to Ms. ObjectDataSource; she told me that Ms. Reflection have some magical powers and so she can get her details about anybody(Object) and also hypnotise anyone(Object) to perform certain actions. This was what Ms. ObjectDataSource was looking for to impress the developers like us. There are few things which she expects from us and once we provide her with those details we can introduce our data control friends to her and ask her to handover the data to them. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Sounds complicated, ok let me simplify there is a contract between Ms. ObjectDataSource(promising to fetch, insert, update, delete data) by invoking methods(hyptonising through her friend Reflection and making objects to perform certain actions). And our data control friends uses those data to display in the form they are requested to. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;I have taken a couple of screen shots, this should help you to better understand her.&lt;/FONT&gt;&lt;/P&gt;
&lt;IMG src="/ScreenShots/ChooseBusinessObjectDialog.JPG" border="0" /&gt;

&lt;IMG src="/ScreenShots/DefineDataMethodsDialog.JPG" border="0" /&gt;


&lt;P&gt;&lt;FONT face=Arial&gt;There are few things we need to know....&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;To get the data, assign the method name(the one which fetches data) of your business object to Ms. ObjectDataSource's SelectMethod.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;//Example&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;objDSCustomers.SelectMethod = "GetCustomers";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;For insert, update, delete follow the same pattern and bind objDSCustomers to the data control.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;//Example&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;grdViewCustomers.DataSourceID = "objDSCustomers";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Although there are many things about Ms. ObjectDataSource which I haven't discussed, but with the above information I am sure now you have a better idea about her.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=6" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry><entry><title>String.IsNullOrEmpty(String)</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/10/StringIsNullOrEmpty.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/10/StringIsNullOrEmpty.aspx</id><published>2006-06-10T09:09:00Z</published><updated>2006-06-10T09:09:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial&gt;As simple as it gets, C# 2.0 has brought with it loads of language features. Some made a huge difference and few less talked about.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;One of them is String's IsNullOrEmpty method, let's do a comparision of C# 1.1 and 2.0 logic to check for a empty and null string. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;We have been doing this past several years, a condition where in we check a string object is null or empty and perform certain actions based on the the outcome of the condition. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;//C# 1.1 Sample code&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;string sParam = null; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;if( (sParam != null) &amp;&amp; (sParam != string.Empty) ) { &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;//Do something &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt; //C# 2.0 Sample code&lt;/STRONG&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;string sParam = null; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;if( string.IsNullOrEmpty(sParam) ) { &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;//Do something &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;} &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Now the difference is pretty clear....same logic but well simplified. Many of you will be wondering why the method IsNullOrEmpty is a static member of string class. Point here is we are checking for null or empty string and if that instance of string is null then it will throw a NullReference exception.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Can the word simply be more simplied? &lt;img src="/emoticons/emotion-5.gif" alt="Wink [;)]" /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=4" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry><entry><title>String.Contains(String)</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/10/StringContains.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/10/StringContains.aspx</id><published>2006-06-10T09:07:00Z</published><updated>2006-06-10T09:07:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial&gt;In our .Net 1.1 days we used to check whether a string object contains a specified string(text) using IndexOf method. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Here is the typical code to check the existence of a string in an string object. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;//Sample code&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;string sName = "John Smith"; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;if(sName.IndexOf("Smith") &gt; -1) { &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;//Smith exists in string object sName &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;} &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Now let's take a closer look at the above code...... What we want is to know whether an instance of string contains some string(text). &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Did I say contains......that's exactly C# .Net 2.0 provides us with. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Let's revisit the same functionality using 2.0 &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;//Sample code&lt;/STRONG&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;string sName = "John Smith"; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;if(sName.Contains("Smith")) { &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;//Smith exists in string object sName &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;} &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Wallah.....it's so simple and sophisticated.&lt;/FONT&gt; &lt;/P&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=3" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry><entry><title>System.Nullable A.k.a Nullable types</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/09/NullableTypes.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/09/NullableTypes.aspx</id><published>2006-06-09T17:10:00Z</published><updated>2006-06-09T17:10:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial&gt;Developers were always looking forward to the inclusion of Nullable types in C#. I love the way it's been implemented using generics. Before we go in to the specifics of Nullable types; let's look at what is a Nullable type and it's usage. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;What's a Nullable type?&lt;/STRONG&gt;&lt;BR&gt;A nullable type is a value type which can be assigned a null value. Type's like int/bool/double/etc... now can be assigned null values. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;Usage:&lt;/STRONG&gt;&lt;BR&gt;A simple case for nullable type is while assigning a database column value to a value type. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt; &lt;BR&gt;int iEmpId = 0; &lt;BR&gt;&lt;STRONG&gt;//Will throw an error if the DataReader value is null&lt;/STRONG&gt;&lt;BR&gt;iEmpId = (int)drEmployee["id"]; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Now let's see how a value type can be promoted to a Nullable type with the magic of generics. &lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Declaring a nullable type is straight forward..&lt;/STRONG&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;System.Nullable iEmpId; &lt;BR&gt;or&lt;BR&gt;int? iEmpId; &lt;STRONG&gt;//that's a shorthand &lt;/STRONG&gt;&lt;BR&gt;iEmpId = null; &lt;STRONG&gt;//Allowed as it's Nullable&lt;/STRONG&gt;&lt;BR&gt;if(iEmpId.HasValue){&lt;BR&gt;//do something &lt;BR&gt;} &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;So for assigning a value from let's say a datareader, we could do something like this. &lt;BR&gt;&lt;BR&gt;int? iEmpId = null; &lt;BR&gt;iEmpId = (int?)drEmployee["id"]; &lt;BR&gt;if(iEmpId.HasValue){&lt;BR&gt;//do something&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Hmm that certainly makes sense, isn't it?&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=5" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry><entry><title>Interned string</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/09/Interned_string.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/09/Interned_string.aspx</id><published>2006-06-09T09:05:00Z</published><updated>2006-06-09T09:05:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial&gt;Interned string is nothing but a locked up version of a string, so that it can be shared.&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Arial&gt;
&lt;P&gt;Memory allocation can be avoided by using string.Empty.&lt;/P&gt;
&lt;P&gt;string sFirstName = string.Empty; &lt;/P&gt;
&lt;P&gt;The C# compiler is intelligent enough to generate code based on our declaration, if we declare a string object with either string.Empty it just refers to a shared empty string object. As we know string object are immutable(cannot be changed) once created so any assignment will not affect the shared string object.&lt;/FONT&gt; &lt;/P&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=2" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry><entry><title>Generics an overview</title><link rel="alternate" type="text/html" href="http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/08/Generics_An_Overview.aspx" /><id>http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/08/Generics_An_Overview.aspx</id><published>2006-06-08T15:38:00Z</published><updated>2006-06-08T15:38:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial&gt;We all have come across a situation where we need to store a collection of a specific type.&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Let's say for example we have a class called Customer and we need to have a collection of customers.&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Simple way of doing that may be to use ArrayList and add customer class to it. But we have to pay a heavy price for using an ArrayList.&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;For those of you who don't know the pitfalls of using ArrayList, let me briefly list it out.&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial&gt;The default initial capacity of an ArrayList is 16, even if you add only 2 items to the ArrayList object it will still occupy memory area of 16 elements.&lt;BR&gt;&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial&gt;Assume you have added 17th element in your ArrayList object then your object will grow to 32 capacity, that's real waste of memory. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial&gt;ArrayList stores everything as object and so any value type you store goes through an overhead of boxing and unboxing. Boxing and Unboxing is the most performance intensive operation in .Net as it has to convert a value type to a reference type and the vice versa. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial&gt;There is no type safety as you can store any type in an ArrayList object.&lt;/FONT&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial&gt;Now where do the Generics come in picture.......??&lt;BR&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/STRONG&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Well they are the saviors in this .Net world, don't believe me then look how simple and smart generics are.&lt;BR&gt;&lt;BR&gt;Now we have a class called Customer and I want a collection of Customer to store n numbers of customers.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt; &lt;STRONG&gt; &lt;FONT face=Arial&gt;//Sample code&lt;/FONT&gt;&lt;BR&gt;&lt;/STRONG&gt; &lt;FONT face=Arial&gt;  objCustomerColl = new List();&lt;BR&gt;&lt;BR&gt;Essentially what we are doing in the above given line of code is we are using the List class which is part of the System.Collections.Generic namespace.&lt;BR&gt;The declaration is pretty simple we are telling the compiler that create a list of Customer class.&lt;BR&gt;&lt;BR&gt;With this simple piece of code we have our CustomerCollection ready for use.&lt;BR&gt;Now we can add, remove and perform many different operations on it.&lt;BR&gt;&lt;BR&gt;  &lt;STRONG&gt;//Sample code&lt;/STRONG&gt;&lt;BR&gt;  objCustomerColl.Add(new Customer());&lt;BR&gt;  Points to be noted....&lt;BR&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;This generic list is type safe.&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial&gt;If you use a value type to create a generic list it doesn't require boxing/unboxing. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial&gt;All the incrementing/decrementing of the list is done under the hood.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Few more examples of Generic list....just to give you an idea of how powerfull are generics.&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;List IntCollection = new List();&lt;BR&gt;List StringCollection = new List();&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://www.fuzzydev.com/aggbug.aspx?PostID=1" width="1" height="1"&gt;</content><author><name>sachinjoshi</name><uri>http://www.fuzzydev.com/members/sachinjoshi.aspx</uri></author></entry></feed>
