<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" gd:etag="W/&quot;CEAEQHc9eCp7ImA9WhRVGEQ.&quot;"><id>tag:blogger.com,1999:blog-6592213425232326503</id><updated>2012-01-18T05:18:21.960-08:00</updated><category term="yahoo" /><category term="mail" /><category term="Repeater" /><category term="css" /><category term="javascript" /><category term="live" /><category term="max-width" /><category term="import" /><category term="contacts" /><category term="min-width" /><category term="Internet Explorer" /><category term="max-height" /><category term="min-height" /><category term="gmail" /><category term="Empty Template" /><category term="vb" /><category term=".NET" /><category term="google" /><title>Gnilly ASP.NET Developer Notes</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://gnillydev.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://gnillydev.blogspot.com/" /><author><name>gnilly boy</name><uri>http://www.blogger.com/profile/13219585280483286310</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/GnillyAspnetDeveloperNotes" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="gnillyaspnetdevelopernotes" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DkYNQ3o4fyp7ImA9WB9UE0g.&quot;"><id>tag:blogger.com,1999:blog-6592213425232326503.post-811983696604449773</id><published>2007-12-10T22:19:00.000-08:00</published><updated>2007-12-10T22:23:12.437-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-10T22:23:12.437-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="contacts" /><title>OpenContacts 1.0 release (with Live/Hotmail support)</title><content type="html">OpenContacts 1.0 with Live support has  released.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://sourceforge.net/project/showfiles.php?group_id=210092&amp;amp;package_id=252191&amp;amp;release_id=560658"&gt;https://sourceforge.net/project/showfiles.php?group_id=210092&amp;amp;package_id=252191&amp;amp;release_id=560658&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now supported:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Import Google Mail contacts&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Import Yahoo Mail contacts&lt;/li&gt;&lt;li&gt;Import Live contacts/Hotmail contacts &lt;/li&gt;&lt;/ol&gt;Thanks&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6592213425232326503-811983696604449773?l=gnillydev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://gnillydev.blogspot.com/feeds/811983696604449773/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6592213425232326503&amp;postID=811983696604449773" title="112 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/811983696604449773?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/811983696604449773?v=2" /><link rel="alternate" type="text/html" href="http://gnillydev.blogspot.com/2007/12/opencontacts-10-release-with.html" title="OpenContacts 1.0 release (with Live/Hotmail support)" /><author><name>gnilly boy</name><uri>http://www.blogger.com/profile/13219585280483286310</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>112</thr:total></entry><entry gd:etag="W/&quot;CUYCQ3g8eCp7ImA9WB9WEU4.&quot;"><id>tag:blogger.com,1999:blog-6592213425232326503.post-29925695403681947</id><published>2007-11-15T05:26:00.001-08:00</published><updated>2007-11-15T05:26:02.670-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-11-15T05:26:02.670-08:00</app:edited><title>OpenContacts.NET is released</title><content type="html">&lt;p&gt;&lt;strong&gt;OpenContacts.NET 1.0 Alpha&lt;/strong&gt; is released. Hosted on &lt;a href="http://sourceforge.net"&gt;SourceForge.net&lt;/a&gt;. &lt;/p&gt; &lt;p&gt;Project link: &lt;a href="http://sourceforge.net/projects/opencontactsnet"&gt;OpenContacts.NET 1.0&lt;/a&gt; (&lt;a href="http://sourceforge.net/projects/opencontactsnet"&gt;http://sourceforge.net/projects/opencontactsnet&lt;/a&gt;)&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Please report bugs, feature requests on project page. Let me know if you what to participate.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Thanks&lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6592213425232326503-29925695403681947?l=gnillydev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://gnillydev.blogspot.com/feeds/29925695403681947/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6592213425232326503&amp;postID=29925695403681947" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/29925695403681947?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/29925695403681947?v=2" /><link rel="alternate" type="text/html" href="http://gnillydev.blogspot.com/2007/11/opencontactsnet-is-released.html" title="OpenContacts.NET is released" /><author><name>gnilly boy</name><uri>http://www.blogger.com/profile/13219585280483286310</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>9</thr:total></entry><entry gd:etag="W/&quot;CkcGQXczeyp7ImA9WB9XGUg.&quot;"><id>tag:blogger.com,1999:blog-6592213425232326503.post-8869695661543645228</id><published>2007-11-13T02:26:00.000-08:00</published><updated>2007-11-13T02:33:40.983-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-11-13T02:33:40.983-08:00</app:edited><title>Default button on ASP.NET form</title><content type="html">&lt;p&gt;I was using special JavaScript for specifying default button in ASP.NET forms. &lt;/p&gt;&lt;br /&gt;&lt;p&gt;I've just found perfect solution: Imagine you created form in asp.net like &lt;br /&gt;&lt;br /&gt;&lt;textarea class="c-sharp" name="code"&gt;&lt;br /&gt;&lt;asp:TextBox id="User" runat="server" /&gt;&lt;br/&gt;&lt;asp:TextBox id="Password" runat="server" textmode="Password" /&gt;&lt;br/&gt;&lt;asp:button id="LoginButton" onclick="LoginButtonClick" runat="server" text="Log In" /&gt;&lt;br /&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;and you need to perform LoginButton click when user presses enter in Password field. Best solution: wrap your form in Panel control and specify DefaultButton property. &lt;br /&gt;&lt;br /&gt;&lt;textarea class="c-sharp" name="code"&gt;&lt;br /&gt;&lt;asp:panel id="Panel_LoginForm" runat="server" defaultbutton="LoginButton"&gt;&lt;br/&gt;&lt;asp:TextBox id="User" runat="server" /&gt;&lt;br/&gt;&lt;asp:TextBox id="Password" runat="server" textmode="Password" /&gt;&lt;br/&gt;&lt;br/&gt;&lt;asp:button id="LoginButton" onclick="LoginButtonClick" runat="server" text="Log In" /&gt;&lt;br /&gt;&lt;br/&gt;&lt;/asp:panel&gt;&lt;br /&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;LoginButton will act like default button. &lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Thanks, Gnilly&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6592213425232326503-8869695661543645228?l=gnillydev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://gnillydev.blogspot.com/feeds/8869695661543645228/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6592213425232326503&amp;postID=8869695661543645228" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/8869695661543645228?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/8869695661543645228?v=2" /><link rel="alternate" type="text/html" href="http://gnillydev.blogspot.com/2007/11/i-was-using-special-javascript-for_13.html" title="Default button on ASP.NET form" /><author><name>gnilly boy</name><uri>http://www.blogger.com/profile/13219585280483286310</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DkQGR3g-cCp7ImA9WB9XFUk.&quot;"><id>tag:blogger.com,1999:blog-6592213425232326503.post-3683924619672984494</id><published>2007-11-08T09:49:00.000-08:00</published><updated>2007-11-08T09:52:06.658-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-11-08T09:52:06.658-08:00</app:edited><title>OpenContacts.NET</title><content type="html">Hi&lt;br /&gt;&lt;br /&gt;I'm planning to release OpenContacts.NET under GNU Lesser public license. OpenContacts.NET is open source .NET library from importing contacts from popular mail services/social networks.&lt;br /&gt;&lt;br /&gt;Now I have code for GMail, Yahoo! and Live.&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Gnilly&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6592213425232326503-3683924619672984494?l=gnillydev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://gnillydev.blogspot.com/feeds/3683924619672984494/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6592213425232326503&amp;postID=3683924619672984494" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/3683924619672984494?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/3683924619672984494?v=2" /><link rel="alternate" type="text/html" href="http://gnillydev.blogspot.com/2007/11/opencontactsnet.html" title="OpenContacts.NET" /><author><name>gnilly boy</name><uri>http://www.blogger.com/profile/13219585280483286310</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>7</thr:total></entry><entry gd:etag="W/&quot;A08AQ389fSp7ImA9WB9XE0s.&quot;"><id>tag:blogger.com,1999:blog-6592213425232326503.post-5507691931992391172</id><published>2007-10-30T10:12:00.000-07:00</published><updated>2007-11-06T09:24:02.165-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-11-06T09:24:02.165-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term=".NET" /><category scheme="http://www.blogger.com/atom/ns#" term="contacts" /><category scheme="http://www.blogger.com/atom/ns#" term="import" /><category scheme="http://www.blogger.com/atom/ns#" term="live" /><title>Live (MSN, Hotmail) contacts importing in c#</title><content type="html">Also it's simple to make Live Contacts importing .NET class.&lt;br /&gt;&lt;br /&gt;Microsoft provides public REST API to user contacts.&lt;br /&gt;You should get TicketAcquirer class from &lt;a href="http://msdn2.microsoft.com/en-us/library/bb447721.aspx"&gt;http://msdn2.microsoft.com/en-us/library/bb447721.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Read details and sample:&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/bb463989.aspx"&gt;http://msdn2.microsoft.com/en-us/library/bb463989.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Main developer page for Live Contacts: &lt;a href="http://dev.live.com/contacts/"&gt;http://dev.live.com/contacts/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Thanks for reading,&lt;br /&gt;Gnilly&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6592213425232326503-5507691931992391172?l=gnillydev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://gnillydev.blogspot.com/feeds/5507691931992391172/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6592213425232326503&amp;postID=5507691931992391172" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/5507691931992391172?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/5507691931992391172?v=2" /><link rel="alternate" type="text/html" href="http://gnillydev.blogspot.com/2007/10/live-msn-hotmail-contacts-importing-in.html" title="Live (MSN, Hotmail) contacts importing in c#" /><author><name>gnilly boy</name><uri>http://www.blogger.com/profile/13219585280483286310</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;C0cCRH04fCp7ImA9WB9QGE8.&quot;"><id>tag:blogger.com,1999:blog-6592213425232326503.post-878123959685932459</id><published>2007-10-30T09:56:00.000-07:00</published><updated>2007-10-31T01:57:45.334-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-10-31T01:57:45.334-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="gmail" /><category scheme="http://www.blogger.com/atom/ns#" term="mail" /><category scheme="http://www.blogger.com/atom/ns#" term="import" /><category scheme="http://www.blogger.com/atom/ns#" term="google" /><title>Import contacts from GMail .NET platform</title><content type="html">&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fgnillydev.blogspot.com%2f2007%2f10%2fimport-contacts-from-gmail-net-platform.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fgnillydev.blogspot.com%2f2007%2f10%2fimport-contacts-from-gmail-net-platform.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Are you want to get free code for importing contacts from other web-mail services?&lt;br /&gt;&lt;br /&gt;I've found working open source .NET library for accessing Google Mail.&lt;br /&gt;&lt;br /&gt;Take a look at &lt;a href="http://johnvey.com/features/gmailapi/"&gt;http://johnvey.com/features/gmailapi/&lt;/a&gt;.&lt;br /&gt;Also they have sourceforge-hosted page: &lt;a href="http://sourceforge.net/projects/gmail-api"&gt;http://sourceforge.net/projects/gmail-api&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I've written GMail importing class in c# in less then 30 minutes.&lt;br /&gt;&lt;br /&gt;Only one problem: code causes runtime errors.&lt;br /&gt;You should find following line&lt;br /&gt;&lt;pre name="code" class="c-sharp"&gt;&lt;br /&gt;// parse the mailbox information&lt;br /&gt;ParseDataPack();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And comment ParseDataPack method call.&lt;br /&gt;&lt;br /&gt;Note: some of GMailAgent features will not work after modification but contacts should work.&lt;br /&gt;&lt;br /&gt;Full modified GmailAdapter code:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="c-sharp:collapse"&gt;&lt;br /&gt;/**************************************************************************&lt;br /&gt;Gmail Agent API&lt;br /&gt;Copyright (C) 2005 Johnvey Hwang, Eric Larson&lt;br /&gt;http://sourceforge.net/projects/gmail-api/&lt;br /&gt;&lt;br /&gt;This program is free software; you can redistribute it and/or&lt;br /&gt;modify it under the terms of the GNU General Public License&lt;br /&gt;as published by the Free Software Foundation; either version 2&lt;br /&gt;of the License, or (at your option) any later version.&lt;br /&gt;&lt;br /&gt;This program is distributed in the hope that it will be useful,&lt;br /&gt;but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;GNU General Public License for more details.&lt;br /&gt;&lt;br /&gt;You should have received a copy of the GNU General Public License&lt;br /&gt;along with this program; if not, write to the Free Software&lt;br /&gt;Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.&lt;br /&gt;**************************************************************************/&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Net;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Text.RegularExpressions;&lt;br /&gt;using System.Diagnostics;&lt;br /&gt;using Johnvey.GmailAgent;&lt;br /&gt;&lt;br /&gt;namespace Johnvey.GmailAgent&lt;br /&gt;{&lt;br /&gt;    /// &lt;summary&gt;&lt;br /&gt;    /// Represents a set of tools used to communicate with the Gmail system.&lt;br /&gt;    /// &lt;/summary&gt;&lt;br /&gt;    public class GmailAdapter&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        #region Enumerations&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the result of a Gmail request.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public enum RequestResponseType&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            /// &lt;summary&gt;&lt;br /&gt;            /// The request was successful.&lt;br /&gt;            /// &lt;/summary&gt;&lt;br /&gt;            Success,&lt;br /&gt;&lt;br /&gt;            /// &lt;summary&gt;&lt;br /&gt;            /// The Google Accounts login information did not validate.&lt;br /&gt;            /// &lt;/summary&gt;&lt;br /&gt;            LoginFailed,&lt;br /&gt;&lt;br /&gt;            /// &lt;summary&gt;&lt;br /&gt;            /// The DataPack request was not successful.&lt;br /&gt;            /// &lt;/summary&gt;&lt;br /&gt;            RefreshFailed&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the type of threads to retrieve.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public enum ThreadFetchType&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            /// &lt;summary&gt;&lt;br /&gt;            /// All unread threads.&lt;br /&gt;            /// &lt;/summary&gt;&lt;br /&gt;            AllUnread,&lt;br /&gt;&lt;br /&gt;            /// &lt;summary&gt;&lt;br /&gt;            /// All unread inbox threads.&lt;br /&gt;            /// &lt;/summary&gt;&lt;br /&gt;            Inbox&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;        #endregion&lt;br /&gt;&lt;br /&gt;        #region Constants&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the URL to POST Google Accounts login information.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        // modified login url to compensate for new login procedure&lt;br /&gt;        // Fix from Eric Larson [larson.eric@gmail.com]; 4/21/2005&lt;br /&gt;        public const string GOOGLE_LOGIN_URL = "https://www.google.com/accounts/ServiceLoginAuth";&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the URL to fake as the GOOGLE_LOGIN_URL's referrer. (I don't know if Google is checking this, but it can't hurt.)&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        // Changed login referrer according to what is currently being used (from my tests)&lt;br /&gt;        // Modified by Eric Larson [larson.eric@gmail.com]; 4/21/2005&lt;br /&gt;        public const string GOOGLE_LOGIN_REFERRER_URL = "https://www.google.com/accounts/ServiceLogin?service=mail&amp;passive=true&amp;rm=false&amp;continue=https%3A%2F%2Fmail.google.com%2Fmail%3Fui%3Dhtml%26zy%3Dl";&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the base URL for Gmail requests.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public const string GMAIL_HOST_URL = "https://mail.google.com";&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the URL to use in the post data "continue" variable on the initial connection&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        // modified login url to compensate for new login procedure&lt;br /&gt;        // Fix from Eric Larson [larson.eric@gmail.com]; 4/21/2005&lt;br /&gt;        public const string GOOGLE_LOGIN_CONTINUE = "https://mail.google.com/mail?";&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the URL to use when sending an invite.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public const string GMAIL_INVITE_URL = "http://mail.google.com/mail?&amp;view=ii";&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the URL to fake as the GOOGLE_INVITE_URL's referrer. (I don't know if Google is checking this, but it can't hurt.)&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public const string GMAIL_INVITE_REFERRER_URL = "http://mail.google.com/mail?&amp;ik=&amp;search=inbox&amp;view=tl&amp;start=0&amp;init=1&amp;zx=vik357vuzj2r";&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the URL to use when adding, editing, or deleting a label.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public const string GMAIL_LABEL_URL = "http://mail.google.com/mail?&amp;ik=&amp;view=up";&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the URL to fake as the GOOGLE_LABEL_URL's referrer. (I don't know if Google is checking this, but it can't hurt.)&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public const string GMAIL_LABEL_REFERRER_URL = "http://mail.google.com/mail?&amp;view=pr&amp;pnl=l";&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the URL to use when adding, editing, or deleting a filter.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public const string GMAIL_FILTER_URL = "https://mail.google.com/mail?";&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the URL to fake as the GOOGLE_FILTER_URL's referrer. (I don't know if Google is checking this, but it can't hurt.)&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public const string GMAIL_FILTER_REFERRER_URL = "https://mail.google.com/mail?&amp;pnl=f";&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the URL to use when adding or editing a contact.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public const string GMAIL_CONTACT_URL = "http://mail.google.com/mail?&amp;ik=&amp;view=up";&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the URL to use when deleting a contact.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public const string GMAIL_CONTACT_DELETE_URL = "http://mail.google.com/mail?";&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Defines the URL to fake as the GOOGLE_CONTACT_URL's and GOOGLE_CONTACT_DELETE_URL's referrer. (I don't know if Google is checking this, but it can't hurt.)&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public const string GMAIL_CONTACT_REFERRER_URL = "http://mail.google.com/mail?&amp;search=contacts&amp;ct_id=1&amp;cvm=2&amp;view=ct";&lt;br /&gt;&lt;br /&gt;        #endregion&lt;br /&gt;&lt;br /&gt;        #region Properties&lt;br /&gt;        private string _jsVersion;&lt;br /&gt;        private GmailSession _session;&lt;br /&gt;        private string _rawLoginResponse;&lt;br /&gt;        private string _rawHomeFrameResponse;&lt;br /&gt;        private string _rawDataPackResponse;&lt;br /&gt;        private string _lastErrorMessage;&lt;br /&gt;        private ThreadFetchType _threadFetchMode;&lt;br /&gt;        private WebProxy _proxy;&lt;br /&gt;        private bool _commandSuccess;&lt;br /&gt;        private string _commandResponse;&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Gets or sets the Gmail JS engine version.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public string JsVersion { get { return _jsVersion; } set { _jsVersion = value; } }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Gets the raw HTML content returned from the Google Accounts login request.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public string RawLoginResponse { get { return _rawLoginResponse; } }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Gets the raw HTML content returned from the Gmail base launch request.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public string RawHomeFrameResponse { get { return _rawHomeFrameResponse; } }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Gets the raw HTML content returned from a DataPack request.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public string RawDataPackResponse { get { return _rawDataPackResponse; } }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Gets the last error message generated by the GmailAdapter methods.  Will be null if there are no errors.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public string LastErrorMessage { get { return _lastErrorMessage; } }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Gets or sets the &lt;see cref="ThreadFetchType"/&gt; for the adapter. The default is &lt;c&gt;Inbox&lt;/c&gt;.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public ThreadFetchType ThreadFetchMode { get { return _threadFetchMode; } set { _threadFetchMode = value; } }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Gets or sets the proxy for HTTP requests.  Leave null for no proxy support.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public WebProxy Proxy { get { return this._proxy; } set { this._proxy = value; } }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Gets or sets the Gmail success status of the current request.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public bool CommandSuccess { get { return _commandSuccess; } set { _commandSuccess = value; } }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Gets or sets the Gmail success message of the current request.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public string CommandResponse { get { return _commandResponse; } set { _commandResponse = value; } }&lt;br /&gt;&lt;br /&gt;        #endregion&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Initializes a new instance of the GmailAdapter class.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public GmailAdapter()&lt;br /&gt;        {&lt;br /&gt;            /**********************************************************************&lt;br /&gt;    * These ServicePointManager settings are here because the .NET&lt;br /&gt;    * Framework (1.0 and 1.1) don't like to play well with other web&lt;br /&gt;    * servers.  Some of these are arbitrary hacks that have been&lt;br /&gt;    * suggested over the newsgroups.  The one that seems to work&lt;br /&gt;    * constistently is using TLS instead of SSL3.  Go figure.&lt;br /&gt;    * NOTE: the Expect100Continue property is not supportted in .NET 1.0.&lt;br /&gt;    * *******************************************************************/&lt;br /&gt;            // ServicePointManager.CertificatePolicy = new GmailCertificatePolicy();&lt;br /&gt;            ServicePointManager.Expect100Continue = false;&lt;br /&gt;            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;&lt;br /&gt;&lt;br /&gt;            this._lastErrorMessage = null;&lt;br /&gt;            this._threadFetchMode = ThreadFetchType.Inbox;&lt;br /&gt;            this._proxy = null;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Represents a delegate for the &lt;see cref="Refresh"/&gt; method.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        public delegate RequestResponseType RefreshDelegate(GmailSession session);&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Queries Gmail to get latest mailbox information.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="session"&gt;The &lt;see cref="GmailSession"/&gt; object to query.&lt;/param&gt;&lt;br /&gt;        /// &lt;returns&gt;The &lt;see cref="RequestResponseType"/&gt;.&lt;/returns&gt;&lt;br /&gt;        public RequestResponseType Refresh(GmailSession session)&lt;br /&gt;        {&lt;br /&gt;            // bring focus to active session&lt;br /&gt;            this._session = session;&lt;br /&gt;&lt;br /&gt;            // make sure there is proper login information&lt;br /&gt;            if (this._session.Username == "" || this._session.Username == null || this._session.Password == "" || this._session.Password == null)&lt;br /&gt;            {&lt;br /&gt;                return RequestResponseType.LoginFailed;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            // if it's been a while since we logged in, do it again to keep the cookie fresh&lt;br /&gt;            if (session.LastLoginTime == new DateTime(0) || session.LastLoginTime &lt; DateTime.Now.AddHours(-1))&lt;br /&gt;            {&lt;br /&gt;                if (Login())&lt;br /&gt;                {&lt;br /&gt;                    return RequestResponseType.Success;&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    return RequestResponseType.LoginFailed;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                if (RefreshDataPack(false))&lt;br /&gt;                {&lt;br /&gt;                    return RequestResponseType.Success;&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    return RequestResponseType.RefreshFailed;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Sends Google Accounts login stored in the current &lt;see cref="GmailSession"/&gt; and establishes a session with Gmail.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;returns&gt;True if login was successful; false otherwise.&lt;/returns&gt;&lt;br /&gt;        private bool Login()&lt;br /&gt;        {&lt;br /&gt;            // grab the user's cookie store&lt;br /&gt;            CookieCollection cookieJar = this._session.Cookies;&lt;br /&gt;&lt;br /&gt;            // put some cookies in it&lt;br /&gt;            GmailCookieFactory tollHouse = new GmailCookieFactory();&lt;br /&gt;            cookieJar.Add(tollHouse.GenerateCookie("GMAIL_LOGIN"));&lt;br /&gt;            cookieJar.Add(tollHouse.GenerateCookie("TZ"));&lt;br /&gt;&lt;br /&gt;            // instantiate the key pieces&lt;br /&gt;            Uri location;&lt;br /&gt;            string rawResponse;&lt;br /&gt;            int currentCursor;&lt;br /&gt;&lt;br /&gt;            /**********************************************************************&lt;br /&gt;    * Login to Google Accounts&lt;br /&gt;    * -- parse response to get the GV cookie (don't know what it's for)&lt;br /&gt;    * *******************************************************************/&lt;br /&gt;            // modified post data to compensate for new login procedure&lt;br /&gt;            // service=mail is necessary&lt;br /&gt;            // rm=false is not necessary, but appeared during testing so I left it&lt;br /&gt;            // Fix from Eric Larson [larson.eric@gmail.com]; 4/21/2005&lt;br /&gt;            string loginPostData = "continue=" + System.Web.HttpUtility.UrlEncode(GOOGLE_LOGIN_CONTINUE)&lt;br /&gt;                                + "&amp;service=mail"&lt;br /&gt;                                + "&amp;rm=false"&lt;br /&gt;                                + "&amp;Email=" + System.Web.HttpUtility.UrlEncode(this._session.Username)&lt;br /&gt;                                + "&amp;Passwd=" + System.Web.HttpUtility.UrlEncode(this._session.Password)&lt;br /&gt;                                + "&amp;null=Sign+in";&lt;br /&gt;            location = new Uri(GOOGLE_LOGIN_URL);&lt;br /&gt;&lt;br /&gt;            // try the request; catch any unhandled exceptions&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                rawResponse = MakeWebRequest(location, "POST", GOOGLE_LOGIN_REFERRER_URL, loginPostData, false);&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                this._session.HasConnectionError = true;&lt;br /&gt;                this._lastErrorMessage = "Unable to log in to Google Accounts: " + ex.Message;&lt;br /&gt;                return false;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            // catch empty response and bad login&lt;br /&gt;            if (rawResponse == null || rawResponse == "")&lt;br /&gt;            {&lt;br /&gt;                this._session.HasConnectionError = true;&lt;br /&gt;                this._lastErrorMessage = "Unable to log in to Google Accounts: empty response document!";&lt;br /&gt;                return false;&lt;br /&gt;            }&lt;br /&gt;            else if (Regex.Match(rawResponse, "password.+not.+match", RegexOptions.Compiled).Success)&lt;br /&gt;            {&lt;br /&gt;                this._session.HasConnectionError = true;&lt;br /&gt;                this._lastErrorMessage = "Unable to log in to Google Accounts: Username (" + this._session.Username + ") and password do not match.";&lt;br /&gt;                return false;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            this._rawLoginResponse = rawResponse;&lt;br /&gt;&lt;br /&gt;            // get _sgh variable from login response&lt;br /&gt;            string var_sgh = "";&lt;br /&gt;            currentCursor = rawResponse.IndexOf("_sgh");&lt;br /&gt;            if (currentCursor &gt; -1)&lt;br /&gt;            {&lt;br /&gt;                int varDeclStart = rawResponse.IndexOf("_sgh%3D", currentCursor) + 7;&lt;br /&gt;                int varDeclEnd = rawResponse.IndexOf("&amp;", varDeclStart + 5, 40);&lt;br /&gt;                var_sgh = rawResponse.Substring(varDeclStart, varDeclEnd - varDeclStart);&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                this._lastErrorMessage = "Unable to find _sgh GET variable.";&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            /**********************************************************************&lt;br /&gt;    * Request Gmail home application frame&lt;br /&gt;    * -- store GMAIL_AT and S cookies passed in the header&lt;br /&gt;    * -- parse response to get Gmail engine version (jsVersion)&lt;br /&gt;    * *******************************************************************/&lt;br /&gt;            location = new Uri(GMAIL_HOST_URL + "/mail?_sgh=" + var_sgh);&lt;br /&gt;&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                rawResponse = MakeWebRequest(location, "GET", GOOGLE_LOGIN_URL, null, false);&lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                this._lastErrorMessage = "Error retrieving Gmail home frame page: " + ex.Message;&lt;br /&gt;                return false;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            this._rawHomeFrameResponse = rawResponse;&lt;br /&gt;&lt;br /&gt;            // get JS version ID&lt;br /&gt;            this._jsVersion = "jsVersionNotFound";&lt;br /&gt;            Match m = Regex.Match(rawResponse, @"\&amp;ver=([a-z0-9]+)", RegexOptions.Compiled);&lt;br /&gt;            if (m.Success)&lt;br /&gt;            {&lt;br /&gt;                this._jsVersion = m.Groups[1].Value;&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                this._lastErrorMessage = "Unable to find JS Gmail engine version.";&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            /**********************************************************************&lt;br /&gt;    * Request initial dataPack page and extract mailbox information&lt;br /&gt;    * *******************************************************************/&lt;br /&gt;            switch (this._threadFetchMode)&lt;br /&gt;            {&lt;br /&gt;                case ThreadFetchType.AllUnread:&lt;br /&gt;                    location = new Uri(GMAIL_HOST_URL + "/mail?search=query&amp;q=is%3Aunread&amp;view=tl&amp;start=0&amp;init=1&amp;zx=" + MakeUniqueUrl());&lt;br /&gt;                    break;&lt;br /&gt;                case ThreadFetchType.Inbox:&lt;br /&gt;                    location = new Uri(GMAIL_HOST_URL + "/mail?search=inbox&amp;view=tl&amp;start=0&amp;init=1&amp;zx=" + MakeUniqueUrl());&lt;br /&gt;                    break;&lt;br /&gt;                default:&lt;br /&gt;                    break;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                rawResponse = MakeWebRequest(location, "GET", null, null, false);&lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                this._session.HasConnectionError = true;&lt;br /&gt;                this._lastErrorMessage = "Unable to retrieve initial DataPack document: " + ex.Message;&lt;br /&gt;                return false;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            if (rawResponse == "" || rawResponse == null)&lt;br /&gt;            {&lt;br /&gt;                this._session.HasConnectionError = true;&lt;br /&gt;                this._lastErrorMessage = "Initial DataPack document did not contain any data.";&lt;br /&gt;                return false;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            Debug.WriteLine(rawResponse);&lt;br /&gt;&lt;br /&gt;            this._rawDataPackResponse = rawResponse;&lt;br /&gt;&lt;br /&gt;            // mark login time&lt;br /&gt;            this._session.LastLoginTime = DateTime.Now;&lt;br /&gt;&lt;br /&gt;            // parse the mailbox information&lt;br /&gt;            //ParseDataPack();&lt;br /&gt;            this._session.LastRefreshTime = DateTime.Now;&lt;br /&gt;&lt;br /&gt;            this._session.HasConnectionError = false;&lt;br /&gt;            return true;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Requests the auto-refresh DataPack.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;remarks&gt;&lt;br /&gt;        /// If the threadlist timestamp has not changed, Gmail will only send a short DataPack.&lt;br /&gt;        /// &lt;/remarks&gt;&lt;br /&gt;        /// &lt;param name="forceRefresh"&gt;DEBUG: Indicates whether to pass an old timestamp, which forces Gmail to resend a full DataPack.&lt;/param&gt;&lt;br /&gt;        public bool RefreshDataPack(bool forceRefresh)&lt;br /&gt;        {&lt;br /&gt;            string tlt;&lt;br /&gt;&lt;br /&gt;            // DEBUG: setting the timestamp to an older time forces Gmail to return a full DataPack&lt;br /&gt;            if (forceRefresh)&lt;br /&gt;            {&lt;br /&gt;                tlt = "fd44c8cfc2";&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                tlt = this._session.ThreadListTimestamp;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            string fp = this._session.Fingerprint;&lt;br /&gt;&lt;br /&gt;            Uri location = null;&lt;br /&gt;            switch (this._threadFetchMode)&lt;br /&gt;            {&lt;br /&gt;                case ThreadFetchType.AllUnread:&lt;br /&gt;                    location = new Uri(GMAIL_HOST_URL + "/mail?view=tl&amp;search=query&amp;start=0&amp;q=is%3Aunread&amp;tlt=" + tlt + "&amp;fp=" + fp + "&amp;auto=1&amp;zx=" + MakeUniqueUrl());&lt;br /&gt;                    break;&lt;br /&gt;                case ThreadFetchType.Inbox:&lt;br /&gt;                    location = new Uri(GMAIL_HOST_URL + "/mail?view=tl&amp;search=inbox&amp;start=0&amp;tlt=" + tlt + "&amp;fp=" + fp + "&amp;auto=1&amp;zx=" + MakeUniqueUrl());&lt;br /&gt;                    break;&lt;br /&gt;                default:&lt;br /&gt;                    break;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                this._rawDataPackResponse = MakeWebRequest(location, "GET", "http://mail.google.com/mail/html/hist2.html", null, false);&lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                this._session.HasConnectionError = true;&lt;br /&gt;                this._lastErrorMessage = "Unable to refresh DataPack document: " + ex.Message;&lt;br /&gt;                return false;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            if (this._rawDataPackResponse == "" || this._rawDataPackResponse == null)&lt;br /&gt;            {&lt;br /&gt;                this._lastErrorMessage = "Initial DataPack document did not contain any data.";&lt;br /&gt;                return false;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            ParseDataPack();&lt;br /&gt;            this._session.LastRefreshTime = DateTime.Now;&lt;br /&gt;&lt;br /&gt;            return true;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        #region Contacts&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Retrieves all the contacts in the user's Gmail address book.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;returns&gt;A &lt;see cref="GmailContactCollection"/&gt; of contacts in address book.&lt;/returns&gt;&lt;br /&gt;        public GmailContactCollection GetContacts()&lt;br /&gt;        {&lt;br /&gt;            // instantiate output vars&lt;br /&gt;            GmailContactCollection output = new GmailContactCollection();&lt;br /&gt;&lt;br /&gt;            // Added the IK the URI to the fit the current protocol&lt;br /&gt;            // Fix by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;            Uri location = new Uri(GMAIL_HOST_URL + "/mail?&amp;ik=" + System.Web.HttpUtility.UrlEncode(this._session.IdentificationKey) + "&amp;view=cl&amp;search=contacts&amp;pnl=a&amp;zx=" + MakeUniqueUrl());&lt;br /&gt;            this._rawDataPackResponse = MakeWebRequest(location, "GET", null, null, true);&lt;br /&gt;&lt;br /&gt;            // sanitize the incoming _rawDataPackResponse&lt;br /&gt;            this._rawDataPackResponse = this._rawDataPackResponse.Replace("\n", "");&lt;br /&gt;&lt;br /&gt;            if (this._rawDataPackResponse.Length &gt; 128)&lt;br /&gt;            {&lt;br /&gt;                // Looping through the data pack response looking for multiple arrays&lt;br /&gt;                // Gmail only puts 15 address in a single array, so search all 'a' (address) arrays.&lt;br /&gt;                // Fix by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;                //int addressBlockStart = this._rawDataPackResponse.IndexOf("D([\"a\"");&lt;br /&gt;&lt;br /&gt;                // Fix by Billy Roebuck [billyroebuck@yahoo.com.au];  6/24/2005&lt;br /&gt;                // Changed the line below (and again at the end of this method) and some of the offset values&lt;br /&gt;                //int addressBlockStart = this._rawDataPackResponse.IndexOf("D([\"a\"");&lt;br /&gt;                int addressBlockStart = this._rawDataPackResponse.IndexOf("D([\"cl\",");&lt;br /&gt;&lt;br /&gt;                while (addressBlockStart &gt; -1)&lt;br /&gt;                {&lt;br /&gt;                    // find the address block&lt;br /&gt;                    addressBlockStart = this._rawDataPackResponse.IndexOf("[", addressBlockStart + 6);&lt;br /&gt;                    int addressBlockEnd = this._rawDataPackResponse.IndexOf("]]);", addressBlockStart) + 1;&lt;br /&gt;&lt;br /&gt;                    string addressBlock = "[" + this._rawDataPackResponse.Substring(addressBlockStart, addressBlockEnd - addressBlockStart) + "]";&lt;br /&gt;                    //addressBlock = addressBlock.Replace("\\\\\\\"", "\"");&lt;br /&gt;&lt;br /&gt;                    // parse the address block into an ArrayList&lt;br /&gt;                    ArrayList addresses = Utilities.ParseJSArray(addressBlock);&lt;br /&gt;&lt;br /&gt;                    // loop through ArrayList of contacts and insert into collection&lt;br /&gt;                    foreach (ArrayList contact in addresses)&lt;br /&gt;                    {&lt;br /&gt;                        GmailContact tmpContact = new GmailContact();&lt;br /&gt;&lt;br /&gt;                        // Using GmailContact Indeces enum for easy changing&lt;br /&gt;                        // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;&lt;br /&gt;                        // Store the contact ID so that we can edit or delete it.&lt;br /&gt;                        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;                        tmpContact.id = int.Parse((string)contact[(int)GmailContact.Indeces.id], System.Globalization.NumberStyles.HexNumber);&lt;br /&gt;&lt;br /&gt;                        tmpContact.Email = contact[(int)GmailContact.Indeces.Email].ToString();&lt;br /&gt;                        tmpContact.Name = contact[(int)GmailContact.Indeces.DefaultName].ToString();&lt;br /&gt;                        if (contact.Count &gt; (int)GmailContact.Indeces.Notes)&lt;br /&gt;                        {&lt;br /&gt;                            tmpContact.Notes = contact[(int)GmailContact.Indeces.Notes].ToString();&lt;br /&gt;                        }&lt;br /&gt;&lt;br /&gt;                        // EmailUnescaped is no longer sent by Gmail, so fake it.&lt;br /&gt;                        // to keep backwards compatibility with 0.6.1 and before&lt;br /&gt;                        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;                        tmpContact.EmailUnescaped = System.Web.HttpUtility.HtmlEncode(contact[(int)GmailContact.Indeces.Email].ToString());&lt;br /&gt;&lt;br /&gt;                        // Frequently mailed can no longer be be determined in a single request.&lt;br /&gt;                        // So initialize all contacts to false and then make second request later.&lt;br /&gt;                        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;                        tmpContact.IsFrequentlyMailed = false;&lt;br /&gt;&lt;br /&gt;                        output.Add(tmpContact);&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    // Check to see if there is another block of contacts.&lt;br /&gt;                    // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;                    //addressBlockStart = this._rawDataPackResponse.IndexOf("D([\"a\"", addressBlockStart);&lt;br /&gt;                    // Fix by Billy Roebuck [billyroebuck@yahoo.com.au];  6/24/2005&lt;br /&gt;                    addressBlockStart = this._rawDataPackResponse.IndexOf("D([\"cl\",", addressBlockStart);&lt;br /&gt;                } ;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            // Pass the current list of contacts to a helper function to find the frequently mailed contacts.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;            GetFrequentlyMailedContacts(output);&lt;br /&gt;&lt;br /&gt;            return output;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Updates IsFrequentlyMailed flag in the contacts collection.&lt;br /&gt;        /// If the contact is not found in the current collection, it is added.&lt;br /&gt;        /// Helper function of GetContacts to update the contacts collection.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="contacts"&gt;List of Gmail contacts; should be all contacts.&lt;/param&gt;&lt;br /&gt;        /// &lt;returns&gt;A &lt;see cref="GmailContactCollection"/&gt; of contacts in address book.&lt;/returns&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        private void GetFrequentlyMailedContacts(GmailContactCollection contacts)&lt;br /&gt;        {&lt;br /&gt;            //frequently mailed&lt;br /&gt;            Uri location = new Uri(GMAIL_HOST_URL + "/mail?&amp;ik=" + System.Web.HttpUtility.UrlEncode(this._session.IdentificationKey) + "&amp;view=cl&amp;search=contacts&amp;pnl=d&amp;zx=" + MakeUniqueUrl());&lt;br /&gt;            this._rawDataPackResponse = MakeWebRequest(location, "GET", null, null, true);&lt;br /&gt;&lt;br /&gt;            // sanitize the incoming _rawDataPackResponse&lt;br /&gt;            this._rawDataPackResponse = this._rawDataPackResponse.Replace("\n", "");&lt;br /&gt;&lt;br /&gt;            if (this._rawDataPackResponse.Length &gt; 128)&lt;br /&gt;            {&lt;br /&gt;                // find the beginning of the address block&lt;br /&gt;                // Fix by Billy Roebuck [billyroebuck@yahoo.com.au];  6/24/2005&lt;br /&gt;                // Changed the line below (and again at the end of this method) and some of the offset values&lt;br /&gt;                //int addressBlockStart = this._rawDataPackResponse.IndexOf("D([\"a\"");&lt;br /&gt;                int addressBlockStart = this._rawDataPackResponse.IndexOf("D([\"cl\",");&lt;br /&gt;&lt;br /&gt;                // make multiple passes to parse all address arrays&lt;br /&gt;                while (addressBlockStart &gt; -1)&lt;br /&gt;                {&lt;br /&gt;                    // find the address block beginning and end&lt;br /&gt;                    addressBlockStart = this._rawDataPackResponse.IndexOf("[", addressBlockStart + 8);&lt;br /&gt;                    int addressBlockEnd = this._rawDataPackResponse.IndexOf("]]);", addressBlockStart) + 2;&lt;br /&gt;&lt;br /&gt;                    // Need to enclose address block in quotes for ParseJSArray to parse it correctly.&lt;br /&gt;                    // Fixed by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;                    // get the address block&lt;br /&gt;                    string addressBlock = "[" + this._rawDataPackResponse.Substring(addressBlockStart, addressBlockEnd - addressBlockStart) + "]";&lt;br /&gt;&lt;br /&gt;                    // parse the address block into an ArrayList&lt;br /&gt;                    ArrayList addresses = Utilities.ParseJSArray(addressBlock);&lt;br /&gt;&lt;br /&gt;                    // loop through ArrayList of contacts and insert into collection&lt;br /&gt;                    foreach (ArrayList contact in addresses)&lt;br /&gt;                    {&lt;br /&gt;                        // Using GmailContact Indeces enum for easy changing&lt;br /&gt;                        // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;&lt;br /&gt;                        GmailContact currentContact = new GmailContact();&lt;br /&gt;                        int i;&lt;br /&gt;&lt;br /&gt;                        // loop through current contacts to update conatct collection&lt;br /&gt;                        for (i = 0; i &lt; contacts.Count; i++)&lt;br /&gt;                        {&lt;br /&gt;                            // Check the contact list to see if the frequently mailed contact is in the collection&lt;br /&gt;                            currentContact = (GmailContact)contacts[i];&lt;br /&gt;                            if (currentContact.id == int.Parse((string)contact[(int)GmailContact.Indeces.id], System.Globalization.NumberStyles.HexNumber))&lt;br /&gt;                            {&lt;br /&gt;                                currentContact.IsFrequentlyMailed = true;&lt;br /&gt;                                break;&lt;br /&gt;                            }&lt;br /&gt;                        }&lt;br /&gt;&lt;br /&gt;                        // If contact was not in the collection, add it&lt;br /&gt;                        if (i == contacts.Count)&lt;br /&gt;                        {&lt;br /&gt;                            GmailContact tmpContact = new GmailContact();&lt;br /&gt;                            tmpContact.id = int.Parse((string)contact[(int)GmailContact.Indeces.id], System.Globalization.NumberStyles.HexNumber);&lt;br /&gt;                            tmpContact.Email = contact[(int)GmailContact.Indeces.Email].ToString();&lt;br /&gt;                            tmpContact.Name = contact[(int)GmailContact.Indeces.DefaultName].ToString();&lt;br /&gt;                            if (contact.Count &gt; (int)GmailContact.Indeces.Notes)&lt;br /&gt;                            {&lt;br /&gt;                                tmpContact.Notes = contact[(int)GmailContact.Indeces.Notes].ToString();&lt;br /&gt;                            }&lt;br /&gt;&lt;br /&gt;                            // to keep backwards compatibility with 0.6.1 and before&lt;br /&gt;                            tmpContact.EmailUnescaped = System.Web.HttpUtility.HtmlEncode(contact[(int)GmailContact.Indeces.Email].ToString());&lt;br /&gt;                            tmpContact.IsFrequentlyMailed = true;&lt;br /&gt;&lt;br /&gt;                            contacts.Add(tmpContact);&lt;br /&gt;                        }&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    // Check to see if there is another block of contacts.&lt;br /&gt;                    //addressBlockStart = this._rawDataPackResponse.IndexOf("D([\"a\"", addressBlockStart);&lt;br /&gt;                    // Fix by Billy Roebuck [billyroebuck@yahoo.com.au];  6/24/2005&lt;br /&gt;                    addressBlockStart = this._rawDataPackResponse.IndexOf("D([\"cl\",", addressBlockStart);&lt;br /&gt;                } ;&lt;br /&gt;            }&lt;br /&gt;            return;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Retrieves all the frequently mailed contacts in the user's Gmail address book.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;returns&gt;A &lt;see cref="GmailContactCollection"/&gt; of frequently mailed contacts in address book.&lt;/returns&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        // Can be used in place of GetContacts if you don't care about all the contacts.&lt;br /&gt;        public GmailContactCollection GetFrequentlyMailedContacts()&lt;br /&gt;        {&lt;br /&gt;            // instantiate output vars&lt;br /&gt;            GmailContactCollection output = new GmailContactCollection();&lt;br /&gt;&lt;br /&gt;            Uri location = new Uri(GMAIL_HOST_URL + "/mail?&amp;ik=" + System.Web.HttpUtility.UrlEncode(this._session.IdentificationKey) + "&amp;view=cl&amp;search=contacts&amp;pnl=d&amp;zx=" + MakeUniqueUrl());&lt;br /&gt;            this._rawDataPackResponse = MakeWebRequest(location, "GET", null, null, true);&lt;br /&gt;&lt;br /&gt;            // sanitize the incoming _rawDataPackResponse&lt;br /&gt;            this._rawDataPackResponse = this._rawDataPackResponse.Replace("\n", "");&lt;br /&gt;&lt;br /&gt;            if (this._rawDataPackResponse.Length &gt; 128)&lt;br /&gt;            {&lt;br /&gt;                // find the beginning of the address block&lt;br /&gt;                //int addressBlockStart = this._rawDataPackResponse.IndexOf("D([\"a\"");&lt;br /&gt;                // Fix by Billy Roebuck [billyroebuck@yahoo.com.au];  6/24/2005&lt;br /&gt;                int addressBlockStart = this._rawDataPackResponse.IndexOf("D([\"cl\",");                 &lt;br /&gt;&lt;br /&gt;                // make multiple passes to parse all address arrays&lt;br /&gt;                while (addressBlockStart &gt; -1)&lt;br /&gt;                {&lt;br /&gt;                    // find the address block beginning and end&lt;br /&gt;                    addressBlockStart = this._rawDataPackResponse.IndexOf("[", addressBlockStart + 8);&lt;br /&gt;                    int addressBlockEnd = this._rawDataPackResponse.IndexOf("]]);", addressBlockStart) + 2;&lt;br /&gt;&lt;br /&gt;                    // get the address block&lt;br /&gt;                    string addressBlock = this._rawDataPackResponse.Substring(addressBlockStart, addressBlockEnd - addressBlockStart);&lt;br /&gt;&lt;br /&gt;                    // parse the address block into an ArrayList&lt;br /&gt;                    ArrayList addresses = Utilities.ParseJSArray(addressBlock);&lt;br /&gt;&lt;br /&gt;                    // loop through ArrayList of contacts and insert into collection&lt;br /&gt;                    foreach (ArrayList contact in addresses)&lt;br /&gt;                    {&lt;br /&gt;                        GmailContact currentContact = new GmailContact();&lt;br /&gt;&lt;br /&gt;                        currentContact.id = int.Parse((string)contact[0], System.Globalization.NumberStyles.HexNumber);&lt;br /&gt;&lt;br /&gt;                        GmailContact tmpContact = new GmailContact();&lt;br /&gt;                        tmpContact.id = int.Parse((string)contact[0], System.Globalization.NumberStyles.HexNumber);&lt;br /&gt;                        tmpContact.Email = contact[3].ToString();&lt;br /&gt;                        tmpContact.Name = contact[1].ToString();&lt;br /&gt;                        if (contact.Count &gt; 4)&lt;br /&gt;                        {&lt;br /&gt;                            tmpContact.Notes = contact[4].ToString();&lt;br /&gt;                        }&lt;br /&gt;&lt;br /&gt;                        // to keep backwards compatibility with 0.6.1 and before&lt;br /&gt;                        tmpContact.EmailUnescaped = System.Web.HttpUtility.HtmlEncode(contact[3].ToString());&lt;br /&gt;                        tmpContact.IsFrequentlyMailed = true;&lt;br /&gt;&lt;br /&gt;                        output.Add(tmpContact);&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    // Check to see if there is another block of contacts.&lt;br /&gt;                    //addressBlockStart = this._rawDataPackResponse.IndexOf("D([\"a\"", addressBlockStart);&lt;br /&gt;                    // Fix by Billy Roebuck [billyroebuck@yahoo.com.au];  6/24/2005&lt;br /&gt;                    addressBlockStart = this._rawDataPackResponse.IndexOf("D([\"cl\",", addressBlockStart); &lt;br /&gt;                } ;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            return output;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Adds a contact into the address book. Emails that already exist will be updated with the new information.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="name"&gt;Contact display name.&lt;/param&gt;&lt;br /&gt;        /// &lt;param name="email"&gt;Contact email address.&lt;/param&gt;&lt;br /&gt;        /// &lt;param name="notes"&gt;Optional notes.&lt;/param&gt;&lt;br /&gt;        /// &lt;returns&gt;True if Gmail accepted the command; false otherwise.&lt;/returns&gt;&lt;br /&gt;        public bool AddContact(string name, string email, string notes)&lt;br /&gt;        {&lt;br /&gt;            // Limit labels to the 100 characters.&lt;br /&gt;            // Not sure if 100 is correct, I need to test actual limit.&lt;br /&gt;            if (name.Length &gt; 100) name = name.Substring(0, 100);&lt;br /&gt;            if (email.Length &gt; 100) email = email.Substring(0, 100);&lt;br /&gt;&lt;br /&gt;            string contactPostData = "act=ec"&lt;br /&gt;                + "&amp;at=" + this._session.Cookies["GMAIL_AT"].Value&lt;br /&gt;                + "&amp;ct_id=-1"&lt;br /&gt;                + "&amp;ct_nm=" + HttpUtility.UrlEncode(name)&lt;br /&gt;                + "&amp;ct_em=" + HttpUtility.UrlEncode(email)&lt;br /&gt;                + "&amp;ctf_n=" + HttpUtility.UrlEncode(notes);&lt;br /&gt;&lt;br /&gt;            Uri location = new Uri(GMAIL_CONTACT_URL);&lt;br /&gt;            this._rawDataPackResponse = MakeWebRequest(location, "POST", GMAIL_CONTACT_REFERRER_URL, contactPostData, false);&lt;br /&gt;&lt;br /&gt;            // Parse the data pack to determine if contact was stored successfully.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            ParseDataPack();&lt;br /&gt;&lt;br /&gt;            // Return Gmail's response to whether the request was successful.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            return this.CommandSuccess;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Edits a contact in the address book.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="id"&gt;ID of the contact on Gmail system.&lt;/param&gt;&lt;br /&gt;        /// &lt;param name="name"&gt;Contact display name.&lt;/param&gt;&lt;br /&gt;        /// &lt;param name="email"&gt;Contact email address.&lt;/param&gt;&lt;br /&gt;        /// &lt;param name="notes"&gt;Optional notes.&lt;/param&gt;&lt;br /&gt;        /// &lt;returns&gt;True if Gmail accepted the command; false otherwise.&lt;/returns&gt;&lt;br /&gt;        /// // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public bool EditContact(int id, string name, string email, string notes)&lt;br /&gt;        {&lt;br /&gt;            if (id &gt; -1)&lt;br /&gt;            {&lt;br /&gt;                string contactPostData = "act=ec"&lt;br /&gt;                    + "&amp;at=" + this._session.Cookies["GMAIL_AT"].Value&lt;br /&gt;                    + "&amp;ct_id=" + id&lt;br /&gt;                    + "&amp;ct_nm=" + System.Web.HttpUtility.UrlEncode(name)&lt;br /&gt;                    + "&amp;ct_em=" + System.Web.HttpUtility.UrlEncode(email)&lt;br /&gt;                    + "&amp;ctf_n=" + System.Web.HttpUtility.UrlEncode(notes);&lt;br /&gt;&lt;br /&gt;                Uri location = new Uri(GMAIL_CONTACT_URL);&lt;br /&gt;                this._rawDataPackResponse = MakeWebRequest(location, "POST", GMAIL_LABEL_REFERRER_URL, contactPostData, false);&lt;br /&gt;&lt;br /&gt;                // Parse the data pack to determine if contact was edited successfully.&lt;br /&gt;                // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;                ParseDataPack();&lt;br /&gt;&lt;br /&gt;                // Return Gmail's response to whether the request was successful.&lt;br /&gt;                // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;                return this.CommandSuccess;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            else&lt;br /&gt;                return false;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Edits a contact in the address book.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="oldEmail"&gt;Email of the contact as it is on Gmail.&lt;/param&gt;&lt;br /&gt;        /// &lt;param name="name"&gt;Contact display name.&lt;/param&gt;&lt;br /&gt;        /// &lt;param name="email"&gt;Contact email address.&lt;/param&gt;&lt;br /&gt;        /// &lt;param name="notes"&gt;Optional notes.&lt;/param&gt;&lt;br /&gt;        /// &lt;returns&gt;True if Gmail accepted the command; false otherwise.&lt;/returns&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public bool EditContact(string oldEmail, string name, string email, string notes)&lt;br /&gt;        {&lt;br /&gt;            // loop through contacts to find the old email address&lt;br /&gt;            foreach (GmailContact contact in this._session.Contacts)&lt;br /&gt;            {&lt;br /&gt;                if (oldEmail == contact.Email)&lt;br /&gt;                {&lt;br /&gt;                    // if Gmail provided an ID for this contact, pass it off to other EditContact function&lt;br /&gt;                    if (contact.id &gt; -1)&lt;br /&gt;                        return EditContact(contact.id, name, email, notes);&lt;br /&gt;                    else&lt;br /&gt;                        return false;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Delete a contact from the address book.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="id"&gt;ID of the contact to delete.&lt;/param&gt;&lt;br /&gt;        /// &lt;returns&gt;True if Gmail accepted the command; false otherwise.&lt;/returns&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public bool DeleteContact(int id)&lt;br /&gt;        {&lt;br /&gt;            if (id &gt; -1)&lt;br /&gt;            {&lt;br /&gt;                string contactGetData = "&amp;ik=" + this._session.IdentificationKey&lt;br /&gt;                    + "&amp;search=contacts"&lt;br /&gt;                    + "&amp;ct_id=" + Convert.ToString(id, 16)&lt;br /&gt;                    + "&amp;cvm=2"&lt;br /&gt;                    + "&amp;view=up"&lt;br /&gt;                    + "&amp;act=dc"&lt;br /&gt;                    + "&amp;at=" + this._session.Cookies["GMAIL_AT"].Value&lt;br /&gt;                    + "&amp;c=" + Convert.ToString(id, 16)&lt;br /&gt;                    + "&amp;zx=" + MakeUniqueUrl();&lt;br /&gt;&lt;br /&gt;                Uri location = new Uri(GMAIL_CONTACT_DELETE_URL + contactGetData);&lt;br /&gt;                this._rawDataPackResponse = MakeWebRequest(location, "GET", GMAIL_LABEL_REFERRER_URL, null, false);&lt;br /&gt;&lt;br /&gt;                // Parse the data pack to determine if contact was deleted successfully.&lt;br /&gt;                // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;                ParseDataPack();&lt;br /&gt;&lt;br /&gt;                // Return Gmail's response to whether the request was successful.&lt;br /&gt;                // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;                return this.CommandSuccess;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            else&lt;br /&gt;                return false;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Delete a contact from the address book.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="email"&gt;Email of the contact to delete.&lt;/param&gt;&lt;br /&gt;        /// &lt;returns&gt;True if Gmail accepted the command; false otherwise.&lt;/returns&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public bool DeleteContact(string email)&lt;br /&gt;        {&lt;br /&gt;            foreach (GmailContact contact in this._session.Contacts)&lt;br /&gt;            {&lt;br /&gt;                if (email == contact.Email)&lt;br /&gt;                {&lt;br /&gt;                    if (contact.id &gt; -1)&lt;br /&gt;                        return DeleteContact(contact.id);&lt;br /&gt;                    else&lt;br /&gt;                        return false;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;        #endregion&lt;br /&gt;&lt;br /&gt;        #region Filters&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Retrieves all the filters in the user's Gmail account.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;returns&gt;A &lt;see cref="GmailFilterCollection"/&gt; of filters.&lt;/returns&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public GmailFilterCollection GetFilters()&lt;br /&gt;        {&lt;br /&gt;            // instantiate output vars&lt;br /&gt;            GmailFilterCollection output = new GmailFilterCollection();&lt;br /&gt;&lt;br /&gt;            Uri location = new Uri(GMAIL_HOST_URL + "/mail?&amp;ik=" + System.Web.HttpUtility.UrlEncode(this._session.IdentificationKey) + "&amp;view=pr&amp;pnl=f&amp;zx=" + MakeUniqueUrl());&lt;br /&gt;            this._rawDataPackResponse = MakeWebRequest(location, "GET", null, null, false);&lt;br /&gt;&lt;br /&gt;            // sanitize the incoming _rawDataPackResponse&lt;br /&gt;            this._rawDataPackResponse = this._rawDataPackResponse.Replace("\n", "");&lt;br /&gt;&lt;br /&gt;            if (this._rawDataPackResponse.Length &gt; 128)&lt;br /&gt;            {&lt;br /&gt;                int filterBlockStart = this._rawDataPackResponse.IndexOf("D([\"fi\"");&lt;br /&gt;&lt;br /&gt;                if (filterBlockStart &gt; -1)&lt;br /&gt;                {&lt;br /&gt;                    // find the filter block&lt;br /&gt;                    filterBlockStart = this._rawDataPackResponse.IndexOf("[", filterBlockStart + 7);&lt;br /&gt;                    int filterBlockEnd = this._rawDataPackResponse.IndexOf("]]);", filterBlockStart) + 1;&lt;br /&gt;&lt;br /&gt;                    string filterBlock = this._rawDataPackResponse.Substring(filterBlockStart, filterBlockEnd - filterBlockStart);&lt;br /&gt;&lt;br /&gt;                    // parse the filter block into an ArrayList&lt;br /&gt;                    ArrayList filters = Utilities.ParseJSArray(filterBlock);&lt;br /&gt;&lt;br /&gt;                    // loop through ArrayList of Filters and insert into collection&lt;br /&gt;                    foreach (ArrayList Filter in filters)&lt;br /&gt;                    {&lt;br /&gt;                        // Using GmailFilter Indeces enum for easy changing&lt;br /&gt;                        // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;&lt;br /&gt;                        GmailFilter tmpFilter = new GmailFilter();&lt;br /&gt;&lt;br /&gt;                        tmpFilter.id = Int64.Parse((string)Filter[(int)GmailFilter.Indeces.id]);&lt;br /&gt;                        tmpFilter.Name = (string)Filter[(int)GmailFilter.Indeces.Name];&lt;br /&gt;&lt;br /&gt;                        // Get subarray of filter settings&lt;br /&gt;                        ArrayList tmpArray = (ArrayList)Filter[(int)GmailFilter.Indeces.SubArray];&lt;br /&gt;                        tmpFilter.From = (string)tmpArray[(int)GmailFilter.SubIndeces.From];&lt;br /&gt;                        tmpFilter.To = (string)tmpArray[(int)GmailFilter.SubIndeces.To];&lt;br /&gt;                        tmpFilter.Subject = (string)tmpArray[(int)GmailFilter.SubIndeces.Subject];&lt;br /&gt;                        tmpFilter.HasWords = (string)tmpArray[(int)GmailFilter.SubIndeces.HasWords];&lt;br /&gt;                        tmpFilter.DoesntHave = (string)tmpArray[(int)GmailFilter.SubIndeces.DoesntHave];&lt;br /&gt;                        tmpFilter.HasAttachment = tmpArray[(int)GmailFilter.SubIndeces.HasAttachment].ToString().Length &gt; 0 &amp;&amp; bool.Parse((string)tmpArray[(int)GmailFilter.SubIndeces.HasAttachment]);&lt;br /&gt;                        tmpFilter.SkipInbox = tmpArray[(int)GmailFilter.SubIndeces.SkipInbox].ToString().Length &gt; 0 &amp;&amp; bool.Parse((string)tmpArray[(int)GmailFilter.SubIndeces.SkipInbox]);&lt;br /&gt;                        tmpFilter.StarIt = tmpArray[(int)GmailFilter.SubIndeces.StarIt].ToString().Length &gt; 0 &amp;&amp; bool.Parse((string)tmpArray[(int)GmailFilter.SubIndeces.StarIt]);&lt;br /&gt;                        tmpFilter.ApplyLabel = tmpArray[(int)GmailFilter.SubIndeces.ApplayLabel].ToString().Length &gt; 0 &amp;&amp; bool.Parse((string)tmpArray[(int)GmailFilter.SubIndeces.ApplayLabel]);&lt;br /&gt;                        tmpFilter.LabelToApply = (string)tmpArray[(int)GmailFilter.SubIndeces.LabelToApply];&lt;br /&gt;                        tmpFilter.Forward = tmpArray[(int)GmailFilter.SubIndeces.Forward].ToString().Length &gt; 0 &amp;&amp; bool.Parse((string)tmpArray[(int)GmailFilter.SubIndeces.Forward]);&lt;br /&gt;                        tmpFilter.ForwardTo = (string)tmpArray[(int)GmailFilter.SubIndeces.ForwardTo];&lt;br /&gt;                        tmpFilter.MoveToTrash = tmpArray[(int)GmailFilter.SubIndeces.MoveToTrash].ToString().Length &gt; 0 &amp;&amp; bool.Parse((string)tmpArray[(int)GmailFilter.SubIndeces.MoveToTrash]);&lt;br /&gt;&lt;br /&gt;                        // I'm not sure why the following fields are sent twice.&lt;br /&gt;                        // If Gmail changes the filter format, these may need to be used.&lt;br /&gt;                        //Filter[GmailFilter.Indeces.StarIt] = StarIt&lt;br /&gt;                        //Filter[GmailFilter.Indeces.LabelToApply] = LabelToApply&lt;br /&gt;                        //Filter[GmailFilter.Indeces.MoveToTrash] = Move To Trash&lt;br /&gt;                        //Filter[GmailFilter.Indeces.MoveToTrash2] = Move To Trash&lt;br /&gt;                        //Filter[GmailFilter.Indeces.ForwardTo] = ForwardTo&lt;br /&gt;                        //Filter[GmailFilter.Indeces.PerpetualFalse] = always seems to be false&lt;br /&gt;&lt;br /&gt;                        output.Add(tmpFilter);&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            return output;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Adds a filter into the set of Gmail filters.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;returns&gt;A &lt;see cref="bool"/&gt; true if completed successfully.&lt;/returns&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public bool AddFilter(GmailFilter filter)&lt;br /&gt;        {&lt;br /&gt;            string strLocation = GMAIL_FILTER_URL&lt;br /&gt;                + "&amp;ik=" + this._session.IdentificationKey&lt;br /&gt;                + "&amp;view=pr"&lt;br /&gt;                + "&amp;pnl=f"&lt;br /&gt;                + "&amp;at=" + this._session.Cookies["GMAIL_AT"].Value&lt;br /&gt;                + "&amp;act=cf"&lt;br /&gt;                + "&amp;cf_t=cf"&lt;br /&gt;                + "&amp;cf1_from=" + System.Web.HttpUtility.UrlEncode(filter.From)&lt;br /&gt;                + "&amp;cf1_to=" + System.Web.HttpUtility.UrlEncode(filter.To)&lt;br /&gt;                + "&amp;cf1_subj=" + System.Web.HttpUtility.UrlEncode(filter.Subject)&lt;br /&gt;                + "&amp;cf1_has=" + System.Web.HttpUtility.UrlEncode(filter.HasWords)&lt;br /&gt;                + "&amp;cf1_hasnot=" + System.Web.HttpUtility.UrlEncode(filter.DoesntHave)&lt;br /&gt;                + "&amp;cf1_attach=" + System.Web.HttpUtility.UrlEncode(filter.HasAttachment.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_ar=" + System.Web.HttpUtility.UrlEncode(filter.SkipInbox.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_st=" + System.Web.HttpUtility.UrlEncode(filter.StarIt.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_cat=" + System.Web.HttpUtility.UrlEncode(filter.ApplyLabel.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_sel=" + System.Web.HttpUtility.UrlEncode(filter.LabelToApply)&lt;br /&gt;                + "&amp;cf2_emc=" + System.Web.HttpUtility.UrlEncode(filter.Forward.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_email=" + System.Web.HttpUtility.UrlEncode(filter.ForwardTo)&lt;br /&gt;                + "&amp;cf2_tr=" + System.Web.HttpUtility.UrlEncode(filter.MoveToTrash.ToString().ToLower())&lt;br /&gt;                + "&amp;zx=" + MakeUniqueUrl();&lt;br /&gt;            Uri location = new Uri(strLocation);&lt;br /&gt;&lt;br /&gt;            string referrer = GMAIL_FILTER_REFERRER_URL&lt;br /&gt;                + "&amp;pnl=f"&lt;br /&gt;                + "&amp;ik=" + this._session.IdentificationKey&lt;br /&gt;                + "&amp;search=cf"&lt;br /&gt;                + "&amp;view=tl"&lt;br /&gt;                + "&amp;start=0"&lt;br /&gt;                + "&amp;cf_f=cf1"&lt;br /&gt;                + "&amp;cf_t=cf2"&lt;br /&gt;                + "&amp;cf1_from=" + System.Web.HttpUtility.UrlEncode(filter.From)&lt;br /&gt;                + "&amp;cf1_to=" + System.Web.HttpUtility.UrlEncode(filter.To)&lt;br /&gt;                + "&amp;cf1_subj=" + System.Web.HttpUtility.UrlEncode(filter.Subject)&lt;br /&gt;                + "&amp;cf1_has=" + System.Web.HttpUtility.UrlEncode(filter.HasWords)&lt;br /&gt;                + "&amp;cf1_hasnot=" + System.Web.HttpUtility.UrlEncode(filter.DoesntHave)&lt;br /&gt;                + "&amp;cf1_attach=" + System.Web.HttpUtility.UrlEncode(filter.HasAttachment.ToString().ToLower())&lt;br /&gt;                + "&amp;zx=" + MakeUniqueUrl();&lt;br /&gt;&lt;br /&gt;            this._rawDataPackResponse = MakeWebRequest(location, "GET", referrer, string.Empty, false);&lt;br /&gt;&lt;br /&gt;            // Parse the data pack to determine if filter was stored successfully.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            ParseDataPack();&lt;br /&gt;&lt;br /&gt;            // Return Gmail's response to whether the request was successful.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            return this.CommandSuccess;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Edits a filter into the set of Gmail filters.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;returns&gt;A &lt;see cref="bool"/&gt; true if completed successfully.&lt;/returns&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public bool EditFilter(GmailFilter filter)&lt;br /&gt;        {&lt;br /&gt;            string strLocation = GMAIL_FILTER_URL&lt;br /&gt;                + "&amp;ik=" + this._session.IdentificationKey&lt;br /&gt;                + "&amp;view=pr"&lt;br /&gt;                + "&amp;pnl=f"&lt;br /&gt;                + "&amp;at=" + this._session.Cookies["GMAIL_AT"].Value&lt;br /&gt;                + "&amp;act=rf"&lt;br /&gt;                + "&amp;cf_t=rf"&lt;br /&gt;                + "&amp;cf1_from=" + System.Web.HttpUtility.UrlEncode(filter.From)&lt;br /&gt;                + "&amp;cf1_to=" + System.Web.HttpUtility.UrlEncode(filter.To)&lt;br /&gt;                + "&amp;cf1_subj=" + System.Web.HttpUtility.UrlEncode(filter.Subject)&lt;br /&gt;                + "&amp;cf1_has=" + System.Web.HttpUtility.UrlEncode(filter.HasWords)&lt;br /&gt;                + "&amp;cf1_hasnot=" + System.Web.HttpUtility.UrlEncode(filter.DoesntHave)&lt;br /&gt;                + "&amp;cf1_attach=" + System.Web.HttpUtility.UrlEncode(filter.HasAttachment.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_ar=" + System.Web.HttpUtility.UrlEncode(filter.SkipInbox.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_st=" + System.Web.HttpUtility.UrlEncode(filter.StarIt.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_cat=" + System.Web.HttpUtility.UrlEncode(filter.ApplyLabel.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_sel=" + System.Web.HttpUtility.UrlEncode(filter.LabelToApply)&lt;br /&gt;                + "&amp;cf2_emc=" + System.Web.HttpUtility.UrlEncode(filter.Forward.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_email=" + System.Web.HttpUtility.UrlEncode(filter.ForwardTo)&lt;br /&gt;                + "&amp;cf2_tr=" + System.Web.HttpUtility.UrlEncode(filter.MoveToTrash.ToString().ToLower())&lt;br /&gt;                + "&amp;ofid=" + System.Web.HttpUtility.UrlEncode(filter.id.ToString())&lt;br /&gt;                + "&amp;zx=" + MakeUniqueUrl();&lt;br /&gt;            Uri location = new Uri(strLocation);&lt;br /&gt;&lt;br /&gt;            string referrer = GMAIL_FILTER_REFERRER_URL&lt;br /&gt;                + "&amp;ik=" + this._session.IdentificationKey&lt;br /&gt;                + "&amp;search=cf"&lt;br /&gt;                + "&amp;view=tl"&lt;br /&gt;                + "&amp;start=0"&lt;br /&gt;                + "&amp;cf_f=cf1"&lt;br /&gt;                + "&amp;cf_t=cf2"&lt;br /&gt;                + "&amp;cf1_from=" + System.Web.HttpUtility.UrlEncode(filter.From)&lt;br /&gt;                + "&amp;cf1_to=" + System.Web.HttpUtility.UrlEncode(filter.To)&lt;br /&gt;                + "&amp;cf1_subj=" + System.Web.HttpUtility.UrlEncode(filter.Subject)&lt;br /&gt;                + "&amp;cf1_has=" + System.Web.HttpUtility.UrlEncode(filter.HasWords)&lt;br /&gt;                + "&amp;cf1_hasnot=" + System.Web.HttpUtility.UrlEncode(filter.DoesntHave)&lt;br /&gt;                + "&amp;cf1_attach=" + System.Web.HttpUtility.UrlEncode(filter.HasAttachment.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_ar=" + System.Web.HttpUtility.UrlEncode(filter.SkipInbox.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_st=" + System.Web.HttpUtility.UrlEncode(filter.StarIt.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_cat=" + System.Web.HttpUtility.UrlEncode(filter.ApplyLabel.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_sel=" + System.Web.HttpUtility.UrlEncode(filter.LabelToApply)&lt;br /&gt;                + "&amp;cf2_emc=" + System.Web.HttpUtility.UrlEncode(filter.Forward.ToString().ToLower())&lt;br /&gt;                + "&amp;cf2_email=" + System.Web.HttpUtility.UrlEncode(filter.ForwardTo)&lt;br /&gt;                + "&amp;cf2_tr=" + System.Web.HttpUtility.UrlEncode(filter.MoveToTrash.ToString().ToLower())&lt;br /&gt;                + "&amp;ofid=" + System.Web.HttpUtility.UrlEncode(filter.id.ToString())&lt;br /&gt;                + "&amp;zx=" + MakeUniqueUrl();&lt;br /&gt;&lt;br /&gt;            this._rawDataPackResponse = MakeWebRequest(location, "GET", referrer, string.Empty, false);&lt;br /&gt;&lt;br /&gt;            // Parse the data pack to determine if filter was edited successfully.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            ParseDataPack();&lt;br /&gt;&lt;br /&gt;            // Return Gmail's response to whether the request was successful.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            return this.CommandSuccess;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Deletes a filter from the set of Gmail filters.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;returns&gt;A &lt;see cref="bool"/&gt; true if completed successfully.&lt;/returns&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public bool DeleteFilter(Int64 id)&lt;br /&gt;        {&lt;br /&gt;            string labelPostData = "act=df_" + id.ToString() +&lt;br /&gt;                "&amp;at=" + this._session.Cookies["GMAIL_AT"].Value;&lt;br /&gt;&lt;br /&gt;            Uri location = new Uri(GMAIL_FILTER_URL + "&amp;ik=&amp;view=up");&lt;br /&gt;            string referrer = GMAIL_FILTER_REFERRER_URL + "&amp;view=pr&amp;ik= " + this._session.IdentificationKey + "&amp;zx=" + MakeUniqueUrl();&lt;br /&gt;&lt;br /&gt;            this._rawDataPackResponse = MakeWebRequest(location, "POST", referrer, labelPostData, false);&lt;br /&gt;&lt;br /&gt;            // Parse the data pack to determine if filter was deleted successfully.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            ParseDataPack();&lt;br /&gt;&lt;br /&gt;            // Return Gmail's response to whether the request was successful.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            return this.CommandSuccess;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Deletes a filter from the set of Gmail filters.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;returns&gt;A &lt;see cref="bool"/&gt; true if completed successfully.&lt;/returns&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public bool DeleteFilter(GmailFilter filter)&lt;br /&gt;        {&lt;br /&gt;            return DeleteFilter(filter.id);&lt;br /&gt;        }&lt;br /&gt;        #endregion&lt;br /&gt;&lt;br /&gt;        #region Labels&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Adds a label to the set of Gmail labels.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;returns&gt;A &lt;see cref="bool"/&gt; true if completed successfully.&lt;/returns&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public bool AddLabel(string label)&lt;br /&gt;        {&lt;br /&gt;            // Limit labels to the 100 characters.&lt;br /&gt;            // Not sure if 100 is correct, I need to test actual limit.&lt;br /&gt;            if (label.Length &gt; 100) label = label.Substring(0, 100);&lt;br /&gt;&lt;br /&gt;            string labelPostData = "act=cc_" + System.Web.HttpUtility.UrlEncode(label) +&lt;br /&gt;                "&amp;at=" + this._session.Cookies["GMAIL_AT"].Value;&lt;br /&gt;&lt;br /&gt;            Uri location = new Uri(GMAIL_LABEL_URL);&lt;br /&gt;            string referrer = GMAIL_LABEL_REFERRER_URL + "&amp;ik= " + this._session.IdentificationKey + "&amp;zx=" + MakeUniqueUrl();&lt;br /&gt;&lt;br /&gt;            this._rawDataPackResponse = MakeWebRequest(location, "POST", referrer, labelPostData, false);&lt;br /&gt;&lt;br /&gt;            // Parse the data pack to determine if label was stored successfully.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            ParseDataPack();&lt;br /&gt;&lt;br /&gt;            // Return Gmail's response to whether the request was successful.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            return this.CommandSuccess;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Delete a label from the set of Gmail labels.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;returns&gt;A &lt;see cref="bool"/&gt; true if completed successfully.&lt;/returns&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public bool DeleteLabel(string label)&lt;br /&gt;        {&lt;br /&gt;            // Limit labels to the 100 characters.&lt;br /&gt;            // Not sure if 100 is correct, I need to test actual limit.&lt;br /&gt;            if (label.Length &gt; 100) label = label.Substring(0, 100);&lt;br /&gt;&lt;br /&gt;            string labelPostData = "act=dc_" + System.Web.HttpUtility.UrlEncode(label) +&lt;br /&gt;                "&amp;at=" + this._session.Cookies["GMAIL_AT"].Value;&lt;br /&gt;&lt;br /&gt;            Uri location = new Uri(GMAIL_LABEL_URL);&lt;br /&gt;            string referrer = GMAIL_LABEL_REFERRER_URL + "&amp;ik= " + this._session.IdentificationKey + "&amp;zx=" + MakeUniqueUrl();&lt;br /&gt;&lt;br /&gt;            this._rawDataPackResponse = MakeWebRequest(location, "POST", referrer, labelPostData, false);&lt;br /&gt;&lt;br /&gt;            // Parse the data pack to determine if label was deleted successfully.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            ParseDataPack();&lt;br /&gt;&lt;br /&gt;            // Return Gmail's response to whether the request was successful.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            return this.CommandSuccess;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Rename a label in the set of Gmail labels.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;returns&gt;A &lt;see cref="bool"/&gt; true if completed successfully.&lt;/returns&gt;&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public bool RenameLabel(string oldName, string newName)&lt;br /&gt;        {&lt;br /&gt;            // Limit labels to the 100 characters.&lt;br /&gt;            // Not sure if 100 is correct, I need to test actual limit.&lt;br /&gt;            if (oldName.Length &gt; 100) oldName = oldName.Substring(0, 100);&lt;br /&gt;            if (newName.Length &gt; 100) newName = newName.Substring(0, 100);&lt;br /&gt;&lt;br /&gt;            string labelPostData = "act=nc_" + System.Web.HttpUtility.UrlEncode(oldName + "^" + newName) +&lt;br /&gt;                "&amp;at=" + this._session.Cookies["GMAIL_AT"].Value;&lt;br /&gt;&lt;br /&gt;            Uri location = new Uri(GMAIL_LABEL_URL);&lt;br /&gt;            string referrer = GMAIL_LABEL_REFERRER_URL + "&amp;ik= " + this._session.IdentificationKey + "&amp;zx=" + MakeUniqueUrl();&lt;br /&gt;&lt;br /&gt;            this._rawDataPackResponse = MakeWebRequest(location, "POST", referrer, labelPostData, false);&lt;br /&gt;&lt;br /&gt;            // Parse the data pack to determine if label was renamed successfully.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            ParseDataPack();&lt;br /&gt;&lt;br /&gt;            // Return Gmail's response to whether the request was successful.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            return this.CommandSuccess;&lt;br /&gt;        }&lt;br /&gt;        #endregion&lt;br /&gt;&lt;br /&gt;        #region Invites&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Send a Gmail invite to an email address.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="email"&gt;Email of the receipient of the invite.&lt;/param&gt;&lt;br /&gt;        /// &lt;returns&gt;True if Gmail accepted the command; false otherwise.&lt;/returns&gt;&lt;br /&gt;        // This may be useless after beta stages.&lt;br /&gt;        // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;        public bool SendInvite(string email)&lt;br /&gt;        {&lt;br /&gt;            string invitePostData = "act=ii"&lt;br /&gt;                + "&amp;at=" + this._session.Cookies["GMAIL_AT"].Value&lt;br /&gt;                + "&amp;em=" + System.Web.HttpUtility.UrlEncode(email);&lt;br /&gt;&lt;br /&gt;            Uri location = new Uri(GMAIL_INVITE_URL + "&amp;ik=" + this._session.IdentificationKey);&lt;br /&gt;&lt;br /&gt;            this._rawDataPackResponse = MakeWebRequest(location, "POST", GMAIL_INVITE_REFERRER_URL, invitePostData, false);&lt;br /&gt;&lt;br /&gt;            // Parse the data pack to determine if invite was sent.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            ParseDataPack();&lt;br /&gt;&lt;br /&gt;            // Return Gmail's response to whether the request was successful.&lt;br /&gt;            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            return this.CommandSuccess;&lt;br /&gt;        }&lt;br /&gt;        #endregion&lt;br /&gt;&lt;br /&gt;        #region Communication and Parsing&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Reads in the DataPack and extracts relevant mailbox data.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        private void ParseDataPack()&lt;br /&gt;        {&lt;br /&gt;            // sanitize the incoming _rawDataPackResponse&lt;br /&gt;            _rawDataPackResponse = _rawDataPackResponse.Replace("\n", "");&lt;br /&gt;            _rawDataPackResponse = _rawDataPackResponse.Replace("D([", "\nD([");&lt;br /&gt;            _rawDataPackResponse = _rawDataPackResponse.Replace("]);", "]);\n");&lt;br /&gt;&lt;br /&gt;            // extract the fingerprint, i.e. var fp='6c8abc683047b5bc'&lt;br /&gt;            Match fp = Regex.Match(this._rawDataPackResponse, "var fp='([A-Za-z0-9]+)'", RegexOptions.Compiled);&lt;br /&gt;            if (fp.Success)&lt;br /&gt;            {&lt;br /&gt;                this._session.Fingerprint = fp.Groups[1].Value;&lt;br /&gt;&lt;br /&gt;                // clear internal thread store&lt;br /&gt;                this._session.UnreadThreads.Clear();&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                Debug.WriteLine("DataPack error: Could not find the DataPack fingerprint.");&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            // capture all the dataItems&lt;br /&gt;            Regex r = new Regex(@"D\((?&lt;dataItem&gt;\[.+\])\)", RegexOptions.ExplicitCapture | RegexOptions.Compiled);&lt;br /&gt;            Match m = r.Match(_rawDataPackResponse);&lt;br /&gt;&lt;br /&gt;            // loop through all the dataItems and insert accordingly&lt;br /&gt;            while (m.Success)&lt;br /&gt;            {&lt;br /&gt;                // get ArrayList version of dataPack JS array&lt;br /&gt;                ArrayList tmpArray = Utilities.ParseJSArray(m.Groups[1].Value);&lt;br /&gt;&lt;br /&gt;                // get name of DataItem&lt;br /&gt;                string settingName = (string)tmpArray[0];&lt;br /&gt;&lt;br /&gt;                // strip the name element; reindexes the array&lt;br /&gt;                tmpArray.RemoveAt(0);&lt;br /&gt;&lt;br /&gt;                SortedList sl;&lt;br /&gt;                switch (settingName)&lt;br /&gt;                {&lt;br /&gt;                    case "a":&lt;br /&gt;                        Debug.WriteLine("Test");&lt;br /&gt;                        break;&lt;br /&gt;                    case "ds":  // default searches&lt;br /&gt;                        if (tmpArray.Count == 7)&lt;br /&gt;                        {&lt;br /&gt;                            sl = this._session.DefaultSearchCounts;&lt;br /&gt;                            sl["Inbox"] = Int32.Parse((string)tmpArray[0]);&lt;br /&gt;                            sl["Starred"] = Int32.Parse((string)tmpArray[1]);&lt;br /&gt;                            sl["Sent"] = Int32.Parse((string)tmpArray[2]);&lt;br /&gt;                            sl["Drafts"] = Int32.Parse((string)tmpArray[3]);  // fix by Brian Hampson [brian.hampson@gmail.com]; 10/6/2004&lt;br /&gt;                            sl["All"] = Int32.Parse((string)tmpArray[4]);&lt;br /&gt;                            sl["Spam"] = Int32.Parse((string)tmpArray[5]);&lt;br /&gt;                            sl["Trash"] = Int32.Parse((string)tmpArray[6]);&lt;br /&gt;                        }&lt;br /&gt;                        else&lt;br /&gt;                        {&lt;br /&gt;                            Debug.WriteLine("DataPack error: 'ds' did not have expected number of elements (6).");&lt;br /&gt;                        }&lt;br /&gt;                        break;&lt;br /&gt;                    case "ct":  // categories&lt;br /&gt;                        sl = this._session.CategoryCounts;&lt;br /&gt;                        foreach (ArrayList sub in (ArrayList)tmpArray[0])&lt;br /&gt;                        {&lt;br /&gt;                            sl[(string)sub[0]] = Int32.Parse((string)sub[1]);&lt;br /&gt;                        }&lt;br /&gt;                        break;&lt;br /&gt;                    // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;                    case "ar":      // Check Gmail's success/failure response&lt;br /&gt;                        if (tmpArray.Count == 3)&lt;br /&gt;                        {&lt;br /&gt;                            this.CommandSuccess = Int32.Parse(tmpArray[0].ToString()) == 1;&lt;br /&gt;                            this.CommandResponse = tmpArray[1].ToString();&lt;br /&gt;                        }&lt;br /&gt;                        break;&lt;br /&gt;                    case "ts":  // threadlist summary&lt;br /&gt;                        if (tmpArray.Count == 9)&lt;br /&gt;                        {&lt;br /&gt;                            this._session.ThreadListTimestamp = tmpArray[6].ToString();&lt;br /&gt;                            this._session.TotalMessages = Int32.Parse(tmpArray[2].ToString());&lt;br /&gt;                        }&lt;br /&gt;                        else&lt;br /&gt;                        {&lt;br /&gt;                            Debug.WriteLine("DataPack error: 'ts' did not have expected number of elements (7).");&lt;br /&gt;                        }&lt;br /&gt;                        break;&lt;br /&gt;                    case "qu":      // quota information&lt;br /&gt;                        this._session.Quota = int.Parse(((string)tmpArray[1]).Substring(0, tmpArray[1].ToString().Length - 3));&lt;br /&gt;                        this._session.MailboxSize = int.Parse(((string)tmpArray[0]).Substring(0, tmpArray[0].ToString().Length -3));&lt;br /&gt;                        break;&lt;br /&gt;                    case "fi":      // filters&lt;br /&gt;&lt;br /&gt;                        break;&lt;br /&gt;                    case "t":  // message listings *** NOTE: If Gmail changes their spec, this will definitely need to be updated. ***&lt;br /&gt;                        foreach (ArrayList message in tmpArray)&lt;br /&gt;                        {&lt;br /&gt;                            // Using GmailThread Indeces enum for easy changing&lt;br /&gt;                            // Added by Eric Larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;&lt;br /&gt;                            // we really only want the unread messages&lt;br /&gt;                            if ((string)message[(int)GmailThread.Indeces.IsRead] == "1")&lt;br /&gt;                            {&lt;br /&gt;                                GmailThread newMessage = new GmailThread();&lt;br /&gt;                                newMessage.ThreadID = (string)message[(int)GmailThread.Indeces.ID];&lt;br /&gt;                                newMessage.IsRead = ((string)message[(int)GmailThread.Indeces.IsRead] == "1" ? false : true); // Gmail reports isUnread, so we swap&lt;br /&gt;                                newMessage.IsStarred = ((string)message[(int)GmailThread.Indeces.IsStarred] == "1" ? true : false);&lt;br /&gt;                                newMessage.DateHtml = (string)message[(int)GmailThread.Indeces.DateHtml];&lt;br /&gt;                                newMessage.AuthorsHtml = (string)message[(int)GmailThread.Indeces.AuthorsHtml];&lt;br /&gt;                                newMessage.Flags = (string)message[(int)GmailThread.Indeces.Flags];&lt;br /&gt;                                newMessage.SubjectHtml = (string)message[(int)GmailThread.Indeces.SubjectHtml];&lt;br /&gt;                                newMessage.SnippetHtml = (string)message[(int)GmailThread.Indeces.SnippetHtml];&lt;br /&gt;                                newMessage.Categories = (ArrayList)message[(int)GmailThread.Indeces.Categories];&lt;br /&gt;                                newMessage.AttachHtml = (string)message[(int)GmailThread.Indeces.AttachHtml];&lt;br /&gt;                                newMessage.MatchingMessageID = (string)message[(int)GmailThread.Indeces.MatchingMessageID];&lt;br /&gt;                                this._session.UnreadThreads.Add(newMessage);&lt;br /&gt;                            }&lt;br /&gt;                        }&lt;br /&gt;                        break;&lt;br /&gt;                    // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;                    case "ud":      // IK value.  What's IK stand for?  Anyone?&lt;br /&gt;                        this._session.IdentificationKey = (string)tmpArray[2];&lt;br /&gt;                        break;&lt;br /&gt;                    // Added by Eric Larson [larson.eric@gmail.com]; 5/2/2005&lt;br /&gt;                    case "i":       // invitations&lt;br /&gt;                        this._session.Invites.Count = int.Parse((string)tmpArray[0]);&lt;br /&gt;                        break;&lt;br /&gt;                    default:&lt;br /&gt;                        break;&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                // advance to next dataItem&lt;br /&gt;                m = m.NextMatch();&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            this._session.FinalizeUpdate();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Attempts an HTTP request and returns the response document.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="location"&gt;Resource to request.&lt;/param&gt;&lt;br /&gt;        /// &lt;param name="method"&gt;"GET" or "POST".&lt;/param&gt;&lt;br /&gt;        /// &lt;param name="referrer"&gt;The HTTP referer (it's spelled 'referrer', dammit!).&lt;/param&gt;&lt;br /&gt;        /// &lt;param name="postData"&gt;If method if POST, pass the request document; null otherwise.&lt;/param&gt;&lt;br /&gt;        /// &lt;param name="allowAutoRedirect"&gt;Set to true to allow client to follow redirect.&lt;/param&gt;&lt;br /&gt;        /// &lt;returns&gt;&lt;/returns&gt;&lt;br /&gt;        private string MakeWebRequest(Uri location, string method, string referrer, string postData, bool allowAutoRedirect)&lt;br /&gt;        {&lt;br /&gt;            Debug.WriteLine("Initiating " + method + " request at: " + location.ToString());&lt;br /&gt;&lt;br /&gt;            // reset last request's success response&lt;br /&gt;            // Added by Eric larson [larson.eric@gmail.com]; 5/10/2005&lt;br /&gt;            this.CommandResponse = string.Empty;&lt;br /&gt;            this.CommandSuccess = false;&lt;br /&gt;&lt;br /&gt;            // prepare HTTP request&lt;br /&gt;            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(location);&lt;br /&gt;&lt;br /&gt;            // enable proxy support if the user has specified it, or init an empty one&lt;br /&gt;            // Fix from Brian Hampson [brian.hampson@gmail.com]; 10/6/2004&lt;br /&gt;            if (this._proxy != null)&lt;br /&gt;            {&lt;br /&gt;                webRequest.Proxy = this._proxy;&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                webRequest.Proxy = GlobalProxySelection.GetEmptyWebProxy();&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            // if POSTing, add request page and modify the headers&lt;br /&gt;            byte[] encodedPostData = new byte[0];&lt;br /&gt;            if (method == "POST")&lt;br /&gt;            {&lt;br /&gt;                ASCIIEncoding encoding = new ASCIIEncoding();&lt;br /&gt;                encodedPostData = encoding.GetBytes(postData);&lt;br /&gt;                webRequest.Method = "POST";&lt;br /&gt;                webRequest.ContentType = "application/x-www-form-urlencoded";&lt;br /&gt;                webRequest.ContentLength = encodedPostData.Length;&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                webRequest.Method = "GET";&lt;br /&gt;                webRequest.ContentType = "text/html";&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            webRequest.Headers["Accept-Language"] = "en-us,en;q=0.5";&lt;br /&gt;            webRequest.Headers["Accept-Charset"] = "ISO-8859-1,utf-8;q=0.7,*;q=0.7";&lt;br /&gt;            webRequest.ProtocolVersion = HttpVersion.Version11;&lt;br /&gt;            webRequest.AllowAutoRedirect = allowAutoRedirect;&lt;br /&gt;            webRequest.KeepAlive = true;&lt;br /&gt;            webRequest.Referer = referrer;&lt;br /&gt;&lt;br /&gt;            webRequest.CookieContainer = new CookieContainer();&lt;br /&gt;            // adding cookies one-by-one because certain cookies were being added&lt;br /&gt;            // that did not fit the uri path&lt;br /&gt;            // Fix from Eric Larson [larson.eric@gmail.com]; 4/21/2005&lt;br /&gt;            //webRequest.CookieContainer.Add(location, this._session.Cookies);&lt;br /&gt;            foreach (Cookie tmpCookie in this._session.Cookies)&lt;br /&gt;            {&lt;br /&gt;                if ((location.Host.IndexOf(tmpCookie.Domain) &gt; -1) &amp;&amp; (location.AbsolutePath.IndexOf(tmpCookie.Path) &gt; -1))&lt;br /&gt;                {&lt;br /&gt;                    Debug.WriteLine("Cookie: " + tmpCookie.Name + " " + tmpCookie.Value + " " + tmpCookie.Domain + " " + tmpCookie.Path);&lt;br /&gt;                    webRequest.CookieContainer.Add(tmpCookie);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            // updated UserAgent to the most recent version of Mozilla FireFox&lt;br /&gt;            // updated the Accept paramater to match the (my) latest version of Mozilla FireFox&lt;br /&gt;            // updated by Eric Larson [larson.eric@gmail.com]; 4/21/2005&lt;br /&gt;            webRequest.UserAgent = "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3";&lt;br /&gt;            webRequest.Accept = "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";&lt;br /&gt;&lt;br /&gt;            // Attempt to send request stream to server if POSTing&lt;br /&gt;            if (method == "POST")&lt;br /&gt;            {&lt;br /&gt;                Stream requestStream = null;&lt;br /&gt;                try&lt;br /&gt;                {&lt;br /&gt;                    requestStream = webRequest.GetRequestStream();&lt;br /&gt;                    requestStream.Write(encodedPostData, 0, encodedPostData.Length);&lt;br /&gt;                }&lt;br /&gt;                catch (Exception ex)&lt;br /&gt;                {&lt;br /&gt;                    Debug.WriteLine(ex.Message);&lt;br /&gt;                }&lt;br /&gt;                finally&lt;br /&gt;                {&lt;br /&gt;                    if (requestStream != null)&lt;br /&gt;                    {&lt;br /&gt;                        requestStream.Close();&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            // Attempt to get response from server&lt;br /&gt;            HttpWebResponse webResponse = null;&lt;br /&gt;            string output = "";&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                // get response&lt;br /&gt;                webResponse = (HttpWebResponse)webRequest.GetResponse();&lt;br /&gt;                string headers = "";&lt;br /&gt;                foreach (string key in webResponse.Headers.Keys)&lt;br /&gt;                {&lt;br /&gt;                    headers += key + "=" + webResponse.Headers[key] + " | ";&lt;br /&gt;                }&lt;br /&gt;                Debug.WriteLine("   Headers: " + headers);&lt;br /&gt;&lt;br /&gt;                // manually set the GV cookie because ASP.NET doesn't like the subdomain&lt;br /&gt;                if (webResponse.Headers["Set-Cookie"] != null)&lt;br /&gt;                {&lt;br /&gt;                    int tmpCursor = webResponse.Headers["Set-Cookie"].IndexOf("GV=");&lt;br /&gt;                    if (tmpCursor &gt; -1)&lt;br /&gt;                    {&lt;br /&gt;                        int tmpEndCursor = webResponse.Headers["Set-Cookie"].IndexOf(";", tmpCursor);&lt;br /&gt;                        string tmpVal = webResponse.Headers["Set-Cookie"].Substring(tmpCursor + 3, tmpEndCursor - tmpCursor - 3);&lt;br /&gt;                        Debug.WriteLine("   Adding GV cookie: " + tmpVal);&lt;br /&gt;                        Cookie tmpCookie = new Cookie("GV", tmpVal, "/", ".google.com");&lt;br /&gt;                        this._session.Cookies.Add(tmpCookie);&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                // add new cookies to cookie jar&lt;br /&gt;                this._session.Cookies.Add(webResponse.Cookies);&lt;br /&gt;                foreach (Cookie ck in webResponse.Cookies)&lt;br /&gt;                {&lt;br /&gt;                    Debug.WriteLine("   Adding cookie: " + ck.ToString());&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                // read response stream and dump to string&lt;br /&gt;                Stream streamResponse = webResponse.GetResponseStream();&lt;br /&gt;                StreamReader streamRead = new StreamReader(streamResponse);&lt;br /&gt;&lt;br /&gt;                output = streamRead.ReadToEnd();&lt;br /&gt;&lt;br /&gt;                streamRead.Close();&lt;br /&gt;                streamResponse.Close();&lt;br /&gt;&lt;br /&gt;                // the initial login tries to redirect the browser to a temporarily moved page (HTTP 302)&lt;br /&gt;                // but if you set allowAutoRedirect = true, you receive an error about not being able to&lt;br /&gt;                // securely handshaking or something like that (I don't exactly remember)&lt;br /&gt;                // so if google tries to redirect the browser, form a new uri and make a new MakeWebRequest call&lt;br /&gt;                // Fix from Eric Larson [larson.eric@gmail.com]; 4/21/2005&lt;br /&gt;                if (webResponse.Headers["Location"] != null)&lt;br /&gt;                {&lt;br /&gt;                    string redirect = webResponse.Headers["Location"];&lt;br /&gt;                    Uri uriRedirect;&lt;br /&gt;&lt;br /&gt;                    // if redirected to absolute uri&lt;br /&gt;                    if (redirect.IndexOf("http") == 0)&lt;br /&gt;                    {&lt;br /&gt;                        uriRedirect = new Uri(redirect);&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    // if redirected to the current directory of the current uri&lt;br /&gt;                    else if (redirect.IndexOf("/") != 0)&lt;br /&gt;                    {&lt;br /&gt;                        for (int i = location.Segments.GetLength(0) - 2; i &gt;= 0; i--)&lt;br /&gt;                        {&lt;br /&gt;                            redirect = location.Segments[i] + redirect;&lt;br /&gt;                        }&lt;br /&gt;                        uriRedirect = new Uri(location.Scheme + "://" + location.Host + redirect);&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    // else if redirected to the root of the current uri's host&lt;br /&gt;                    else&lt;br /&gt;                    {&lt;br /&gt;                        uriRedirect = new Uri(location.Scheme + "://" + location.Host + redirect);&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    // make recursive web request call&lt;br /&gt;                    output = MakeWebRequest(uriRedirect, "GET", GOOGLE_LOGIN_REFERRER_URL, string.Empty, false);&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                Debug.WriteLine("Received response (" + output.Length + " char(s))");&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                Debug.WriteLine(ex.Message);&lt;br /&gt;            }&lt;br /&gt;            finally&lt;br /&gt;            {&lt;br /&gt;                if (webResponse != null)&lt;br /&gt;                {&lt;br /&gt;                    webResponse.Close();&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            // return the response document&lt;br /&gt;            return output;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Generates a proxy defeating random string (passed as the 'zx' GET variable).&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;returns&gt;Random string composed of JS version and random string.&lt;/returns&gt;&lt;br /&gt;        private string MakeUniqueUrl()&lt;br /&gt;        {&lt;br /&gt;            Random rnd = new Random();&lt;br /&gt;&lt;br /&gt;            // The significance of 2147483648 is that it's equal to 2^32, or 2GB.&lt;br /&gt;            return this._jsVersion + Convert.ToString((Math.Round(rnd.Next(1, 999) * 2147483.648)));&lt;br /&gt;        }&lt;br /&gt;        #endregion&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Gnilly&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6592213425232326503-878123959685932459?l=gnillydev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://gnillydev.blogspot.com/feeds/878123959685932459/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6592213425232326503&amp;postID=878123959685932459" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/878123959685932459?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/878123959685932459?v=2" /><link rel="alternate" type="text/html" href="http://gnillydev.blogspot.com/2007/10/import-contacts-from-gmail-net-platform.html" title="Import contacts from GMail .NET platform" /><author><name>gnilly boy</name><uri>http://www.blogger.com/profile/13219585280483286310</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>8</thr:total></entry><entry gd:etag="W/&quot;DEMNRXg6eyp7ImA9WB9QE0Q.&quot;"><id>tag:blogger.com,1999:blog-6592213425232326503.post-7304556471483586673</id><published>2007-10-26T03:58:00.001-07:00</published><updated>2007-10-26T04:01:34.613-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-10-26T04:01:34.613-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Empty Template" /><category scheme="http://www.blogger.com/atom/ns#" term="Repeater" /><title>EmptyRepeater - Repeater with Empty Template</title><content type="html">&lt;p&gt;When I'm using ASP.NET &lt;strong&gt;Repeater&lt;/strong&gt; instead of I can't find &lt;strong&gt;EmptyDataTemplate&lt;/strong&gt; like in &lt;strong&gt;GridView&lt;/strong&gt;. I've implemented Repeater with Empty template. &lt;/p&gt; &lt;p&gt; &lt;pre name="code" class="c-sharp"&gt;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;&lt;br /&gt;namespace Gnilly.Controls&lt;br /&gt;{&lt;br /&gt;    public class EmptyRepeater : Repeater&lt;br /&gt;    {&lt;br /&gt;        private ITemplate _emptyTemplate;&lt;br /&gt;&lt;br /&gt;        public ITemplate EmptyTemplate&lt;br /&gt;        {&lt;br /&gt;            get { return _emptyTemplate; }&lt;br /&gt;            set { _emptyTemplate = value; }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        protected override void CreateControlHierarchy( bool useDataSource )&lt;br /&gt;        {&lt;br /&gt;            IEnumerable data = GetData();&lt;br /&gt;            if ( EmptyTemplate != null &amp;&amp; data != null &amp;&amp; !data.GetEnumerator().MoveNext() )&lt;br /&gt;            {&lt;br /&gt;                WebControl control = new WebControl( HtmlTextWriterTag.Div );&lt;br /&gt;                EmptyTemplate.InstantiateIn( control );&lt;br /&gt;                Controls.Add( control );&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                base.CreateControlHierarchy( useDataSource );&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6592213425232326503-7304556471483586673?l=gnillydev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://gnillydev.blogspot.com/feeds/7304556471483586673/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6592213425232326503&amp;postID=7304556471483586673" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/7304556471483586673?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/7304556471483586673?v=2" /><link rel="alternate" type="text/html" href="http://gnillydev.blogspot.com/2007/10/emptyrepeater-repeater-with-empty.html" title="EmptyRepeater - Repeater with Empty Template" /><author><name>gnilly boy</name><uri>http://www.blogger.com/profile/13219585280483286310</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;DUEDR3kzeyp7ImA9WB9QE00.&quot;"><id>tag:blogger.com,1999:blog-6592213425232326503.post-6169847691384752730</id><published>2007-10-25T02:44:00.000-07:00</published><updated>2007-10-25T03:21:16.783-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-10-25T03:21:16.783-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="vb" /><category scheme="http://www.blogger.com/atom/ns#" term="yahoo" /><category scheme="http://www.blogger.com/atom/ns#" term="import" /><title /><content type="html">Thanks to &lt;a href="http://www.blogger.com/profile/04322931260765526179"&gt;Nikie&lt;/a&gt; for Visual Basic .NET version on Yahoo! importing code!&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="vb.net"&gt;&lt;br /&gt;Imports System&lt;br /&gt;Imports System.Collections.Specialized&lt;br /&gt;Imports System.Net&lt;br /&gt;Imports System.Text&lt;br /&gt;Imports System.Text.RegularExpressions&lt;br /&gt;Imports MailContact&lt;br /&gt;&lt;br /&gt;Imports System.Collections&lt;br /&gt;&lt;br /&gt;Namespace Gnilly.Syndication.Mail&lt;br /&gt;    Public Class YahooExtract&lt;br /&gt;        Private Const _addressBookUrl As String = "http://address.yahoo.com/yab/us/Yahoo_ab.csv?loc=us&amp;.rand=1671497644&amp;A=H&amp;Yahoo_ab.csv"&lt;br /&gt;        Private Const _authUrl As String = "https://login.yahoo.com/config/login?"&lt;br /&gt;        Private Const _loginPage As String = "https://login.yahoo.com/config/login"&lt;br /&gt;        Private Const _userAgent As String = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3"&lt;br /&gt;        Public Function Extract(ByVal uname As String, ByVal upass As String) As ArrayList&lt;br /&gt;            Dim result As Boolean = False&lt;br /&gt;            Dim myarray As New ArrayList&lt;br /&gt;&lt;br /&gt;            Try&lt;br /&gt;                Dim webClient As New WebClient()&lt;br /&gt;                webClient.Headers(HttpRequestHeader.UserAgent) = _userAgent&lt;br /&gt;                webClient.Encoding = Encoding.UTF8&lt;br /&gt;&lt;br /&gt;                Dim firstResponse As Byte() = webClient.DownloadData(_loginPage)&lt;br /&gt;                Dim firstRes As String = Encoding.UTF8.GetString(firstResponse)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                Dim postToLogin As New NameValueCollection()&lt;br /&gt;                Dim regex As New Regex("type=""hidden"" name=""(.*?)"" value=""(.*?)""", RegexOptions.IgnoreCase)&lt;br /&gt;                Dim match As Match = regex.Match(firstRes)&lt;br /&gt;                While match.Success&lt;br /&gt;                    If match.Groups(0).Value.Length &gt; 0 Then&lt;br /&gt;                        postToLogin.Add(match.Groups(1).Value, match.Groups(2).Value)&lt;br /&gt;                    End If&lt;br /&gt;                    match = regex.Match(firstRes, match.Index + match.Length)&lt;br /&gt;                End While&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                postToLogin.Add(".save", "Sign In")&lt;br /&gt;                postToLogin.Add(".persistent", "y")&lt;br /&gt;&lt;br /&gt;                'Dim login As String = credential.UserName.Split("@"c)(0)&lt;br /&gt;                Dim login As String = uname.Split("@")(0)&lt;br /&gt;&lt;br /&gt;                postToLogin.Add("login", login)&lt;br /&gt;                postToLogin.Add("passwd", upass)&lt;br /&gt;&lt;br /&gt;                webClient.Headers(HttpRequestHeader.UserAgent) = _userAgent&lt;br /&gt;                webClient.Headers(HttpRequestHeader.Referer) = _loginPage&lt;br /&gt;                webClient.Encoding = Encoding.UTF8&lt;br /&gt;                webClient.Headers(HttpRequestHeader.Cookie) = webClient.ResponseHeaders(HttpResponseHeader.SetCookie)&lt;br /&gt;&lt;br /&gt;                webClient.UploadValues(_authUrl, postToLogin)&lt;br /&gt;                Dim cookie As String = webClient.ResponseHeaders(HttpResponseHeader.SetCookie)&lt;br /&gt;&lt;br /&gt;                'If String.IsNullOrEmpty(cookie) Then&lt;br /&gt;                'Return False&lt;br /&gt;                'End If&lt;br /&gt;&lt;br /&gt;                Dim newCookie As String = String.Empty&lt;br /&gt;                Dim tmp1 As String() = cookie.Split(","c)&lt;br /&gt;                For Each var As String In tmp1&lt;br /&gt;                    Dim tmp2 As String() = var.Split(";"c)&lt;br /&gt;                    newCookie = IIf([String].IsNullOrEmpty(newCookie), tmp2(0), newCookie + ";" + tmp2(0))&lt;br /&gt;                Next&lt;br /&gt;&lt;br /&gt;                ' set login cookie&lt;br /&gt;                webClient.Headers(HttpRequestHeader.Cookie) = newCookie&lt;br /&gt;                Dim thirdResponse As Byte() = webClient.DownloadData(_addressBookUrl)&lt;br /&gt;                Dim thirdRes As String = Encoding.UTF8.GetString(thirdResponse)&lt;br /&gt;&lt;br /&gt;                Dim crumb As String = String.Empty&lt;br /&gt;                Dim regexCrumb As New Regex("type=""hidden"" name=""\.crumb"" id=""crumb1"" value=""(.*?)""", RegexOptions.IgnoreCase)&lt;br /&gt;                match = regexCrumb.Match(thirdRes)&lt;br /&gt;                If match.Success AndAlso match.Groups(0).Value.Length &gt; 0 Then&lt;br /&gt;                    crumb = match.Groups(1).Value&lt;br /&gt;                End If&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                Dim postDataAB As New NameValueCollection()&lt;br /&gt;                postDataAB.Add(".crumb", crumb)&lt;br /&gt;                postDataAB.Add("vcp", "import_export")&lt;br /&gt;                postDataAB.Add("submit[action_export_yahoo]", "Export Now")&lt;br /&gt;&lt;br /&gt;                webClient.Headers(HttpRequestHeader.UserAgent) = _userAgent&lt;br /&gt;                webClient.Headers(HttpRequestHeader.Referer) = _addressBookUrl&lt;br /&gt;&lt;br /&gt;                Dim FourResponse As Byte() = webClient.UploadValues(_addressBookUrl, postDataAB)&lt;br /&gt;                Dim csvData As String = Encoding.UTF8.GetString(FourResponse)&lt;br /&gt;&lt;br /&gt;                Dim lines As String() = csvData.Split(Chr(10))&lt;br /&gt;                'Dim list1 As Hashtable()&lt;br /&gt;&lt;br /&gt;                For Each line As String In lines&lt;br /&gt;                    Dim items As String() = line.Split(","c)&lt;br /&gt;                    If items.Length &lt; 5 Then&lt;br /&gt;                        Continue For&lt;br /&gt;                    End If&lt;br /&gt;                    Dim email As String = items(4)&lt;br /&gt;                    Dim name As String = items(3)&lt;br /&gt;                    If Not String.IsNullOrEmpty(email) AndAlso Not String.IsNullOrEmpty(name) Then&lt;br /&gt;                        email = email.Trim(""""c)&lt;br /&gt;                        name = name.Trim(""""c)&lt;br /&gt;                        If Not email.Equals("Email") AndAlso Not name.Equals("Nickname") Then&lt;br /&gt;                            Dim mailContact As New MailContact()&lt;br /&gt;                            mailContact.Name = name&lt;br /&gt;                            mailContact.Email = email&lt;br /&gt;                            myarray.Add(email)&lt;br /&gt;                            'list.Add(mailContact)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                        End If&lt;br /&gt;                    End If&lt;br /&gt;                Next&lt;br /&gt;&lt;br /&gt;                result = True&lt;br /&gt;            Catch&lt;br /&gt;            End Try&lt;br /&gt;            Return myarray&lt;br /&gt;        End Function&lt;br /&gt;    End Class&lt;br /&gt;End Namespace&lt;br /&gt;&lt;br /&gt;Public Class MailContact&lt;br /&gt;    Private _email As String = String.Empty&lt;br /&gt;    Private _name As String = String.Empty&lt;br /&gt;&lt;br /&gt;    Public Property Name() As String&lt;br /&gt;        Get&lt;br /&gt;            Return _name&lt;br /&gt;        End Get&lt;br /&gt;        Set(ByVal value As String)&lt;br /&gt;            _name = value&lt;br /&gt;        End Set&lt;br /&gt;    End Property&lt;br /&gt;&lt;br /&gt;    Public Property Email() As String&lt;br /&gt;        Get&lt;br /&gt;            Return _email&lt;br /&gt;        End Get&lt;br /&gt;        Set(ByVal value As String)&lt;br /&gt;            _email = value&lt;br /&gt;        End Set&lt;br /&gt;    End Property&lt;br /&gt;&lt;br /&gt;    Public ReadOnly Property FullEmail() As String&lt;br /&gt;        Get&lt;br /&gt;            Return Email&lt;br /&gt;        End Get&lt;br /&gt;    End Property&lt;br /&gt;End Class&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6592213425232326503-6169847691384752730?l=gnillydev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://gnillydev.blogspot.com/feeds/6169847691384752730/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6592213425232326503&amp;postID=6169847691384752730" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/6169847691384752730?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/6169847691384752730?v=2" /><link rel="alternate" type="text/html" href="http://gnillydev.blogspot.com/2007/10/thanks-to-nikie-for-visual-basic.html" title="" /><author><name>gnilly boy</name><uri>http://www.blogger.com/profile/13219585280483286310</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>4</thr:total></entry><entry gd:etag="W/&quot;AkIEQHk6eCp7ImA9WB9QFE8.&quot;"><id>tag:blogger.com,1999:blog-6592213425232326503.post-4955102728762127436</id><published>2007-10-17T04:08:00.000-07:00</published><updated>2007-10-26T12:55:01.710-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-10-26T12:55:01.710-07:00</app:edited><title>Yahoo! Contact Import class in C#</title><content type="html">&lt;p&gt;I tried to find free Yahoo! Contact import code for .NET platform. I found only paid packages for 300+$.&lt;/p&gt; &lt;p&gt;&lt;br&gt;I've implemented importing and you can use it for free.&lt;br&gt;(But you need to make some change in code to compile it)&lt;/p&gt; &lt;p&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;&lt;/p&gt;  &lt;pre name="code" class="c-sharp"&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections.Specialized;&lt;br /&gt;using System.Net;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Text.RegularExpressions;&lt;br /&gt;&lt;br /&gt;namespace Gnilly.Syndication.Mail&lt;br /&gt;{&lt;br /&gt;    public class YahooExtract&lt;br /&gt;    {&lt;br /&gt;        private const string _addressBookUrl = "http://address.yahoo.com/yab/us/Yahoo_ab.csv?loc=us&amp;.rand=1671497644&amp;A=H&amp;Yahoo_ab.csv";&lt;br /&gt;        private const string _authUrl = "https://login.yahoo.com/config/login?";&lt;br /&gt;        private const string _loginPage = "https://login.yahoo.com/config/login";&lt;br /&gt;        private const string _userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3";&lt;br /&gt;&lt;br /&gt;        public bool Extract( NetworkCredential credential, out MailContactList list )&lt;br /&gt;        {&lt;br /&gt;            bool result = false;&lt;br /&gt;&lt;br /&gt;            list = new MailContactList();&lt;br /&gt;&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                WebClient webClient = new WebClient();&lt;br /&gt;                webClient.Headers[ HttpRequestHeader.UserAgent ] = _userAgent;&lt;br /&gt;                webClient.Encoding = Encoding.UTF8;&lt;br /&gt;&lt;br /&gt;                byte[] firstResponse = webClient.DownloadData( _loginPage );&lt;br /&gt;                string firstRes = Encoding.UTF8.GetString( firstResponse );&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                NameValueCollection postToLogin = new NameValueCollection();&lt;br /&gt;                Regex regex = new Regex( "type=\"hidden\" name=\"(.*?)\" value=\"(.*?)\"", RegexOptions.IgnoreCase );&lt;br /&gt;                Match match = regex.Match( firstRes );&lt;br /&gt;                while ( match.Success )&lt;br /&gt;                {&lt;br /&gt;                    if ( match.Groups[ 0 ].Value.Length &gt; 0 )&lt;br /&gt;                    {&lt;br /&gt;                        postToLogin.Add( match.Groups[ 1 ].Value, match.Groups[ 2 ].Value );&lt;br /&gt;                    }&lt;br /&gt;                    match = regex.Match( firstRes, match.Index + match.Length );&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                postToLogin.Add( ".save", "Sign In" );&lt;br /&gt;                postToLogin.Add( ".persistent", "y" );&lt;br /&gt;&lt;br /&gt;                string login = credential.UserName.Split( '@' )[ 0 ];&lt;br /&gt;                postToLogin.Add( "login", login );&lt;br /&gt;                postToLogin.Add( "passwd", credential.Password );&lt;br /&gt;&lt;br /&gt;                webClient.Headers[ HttpRequestHeader.UserAgent ] = _userAgent;&lt;br /&gt;                webClient.Headers[ HttpRequestHeader.Referer ] = _loginPage;&lt;br /&gt;                webClient.Encoding = Encoding.UTF8;&lt;br /&gt;                webClient.Headers[ HttpRequestHeader.Cookie ] = webClient.ResponseHeaders[ HttpResponseHeader.SetCookie ];&lt;br /&gt;&lt;br /&gt;                webClient.UploadValues( _authUrl, postToLogin );&lt;br /&gt;                string cookie = webClient.ResponseHeaders[ HttpResponseHeader.SetCookie ];&lt;br /&gt;&lt;br /&gt;                if ( string.IsNullOrEmpty( cookie ) )&lt;br /&gt;                {&lt;br /&gt;                    return false;&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                string newCookie = string.Empty;&lt;br /&gt;                string[] tmp1 = cookie.Split( ',' );&lt;br /&gt;                foreach ( string var in tmp1 )&lt;br /&gt;                {&lt;br /&gt;                    string[] tmp2 = var.Split( ';' );&lt;br /&gt;                    newCookie = String.IsNullOrEmpty( newCookie ) ? tmp2[ 0 ] : newCookie + ";" + tmp2[ 0 ];&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                // set login cookie&lt;br /&gt;                webClient.Headers[ HttpRequestHeader.Cookie ] = newCookie;&lt;br /&gt;                byte[] thirdResponse = webClient.DownloadData( _addressBookUrl );&lt;br /&gt;                string thirdRes = Encoding.UTF8.GetString( thirdResponse );&lt;br /&gt;&lt;br /&gt;                string crumb = string.Empty;&lt;br /&gt;                Regex regexCrumb = new Regex( "type=\"hidden\" name=\"\\.crumb\" id=\"crumb1\" value=\"(.*?)\"", RegexOptions.IgnoreCase );&lt;br /&gt;                match = regexCrumb.Match( thirdRes );&lt;br /&gt;                if ( match.Success &amp;&amp; match.Groups[ 0 ].Value.Length &gt; 0 )&lt;br /&gt;                {&lt;br /&gt;                    crumb = match.Groups[ 1 ].Value;&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                NameValueCollection postDataAB = new NameValueCollection();&lt;br /&gt;                postDataAB.Add( ".crumb", crumb );&lt;br /&gt;                postDataAB.Add( "vcp", "import_export" );&lt;br /&gt;                postDataAB.Add( "submit[action_export_yahoo]", "Export Now" );&lt;br /&gt;&lt;br /&gt;                webClient.Headers[ HttpRequestHeader.UserAgent ] = _userAgent;&lt;br /&gt;                webClient.Headers[ HttpRequestHeader.Referer ] = _addressBookUrl;&lt;br /&gt;&lt;br /&gt;                byte[] FourResponse = webClient.UploadValues( _addressBookUrl, postDataAB );&lt;br /&gt;                string csvData = Encoding.UTF8.GetString( FourResponse );&lt;br /&gt;&lt;br /&gt;                string[] lines = csvData.Split( '\n' );&lt;br /&gt;                foreach ( string line in lines )&lt;br /&gt;                {&lt;br /&gt;                    string[] items = line.Split( ',' );&lt;br /&gt;                    if ( items.Length &lt; 5 )&lt;br /&gt;                    {&lt;br /&gt;                        continue;&lt;br /&gt;                    }&lt;br /&gt;                    string email = items[ 4 ];&lt;br /&gt;                    string name = items[ 3 ];&lt;br /&gt;                    if ( !string.IsNullOrEmpty( email ) &amp;&amp; !string.IsNullOrEmpty( name ) )&lt;br /&gt;                    {&lt;br /&gt;                        email = email.Trim( '\"' );&lt;br /&gt;                        name = name.Trim( '\"' );&lt;br /&gt;                        if ( !email.Equals( "Email" ) &amp;&amp; !name.Equals( "Nickname" ) )&lt;br /&gt;                        {&lt;br /&gt;                            MailContact mailContact = new MailContact();&lt;br /&gt;                            mailContact.Name = name;&lt;br /&gt;                            mailContact.Email = email;&lt;br /&gt;                            list.Add( mailContact );&lt;br /&gt;                        }&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                result = true;&lt;br /&gt;            }&lt;br /&gt;            catch&lt;br /&gt;            {&lt;br /&gt;            }&lt;br /&gt;            return result;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt; &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fgnillydev.blogspot.com%2f2007%2f10%2fyahoo-contact-import-class-in-c.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fgnillydev.blogspot.com%2f2007%2f10%2fyahoo-contact-import-class-in-c.html&amp;fgcolor=000000&amp;bgcolor=FFFFFF" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6592213425232326503-4955102728762127436?l=gnillydev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://gnillydev.blogspot.com/feeds/4955102728762127436/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6592213425232326503&amp;postID=4955102728762127436" title="61 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/4955102728762127436?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/4955102728762127436?v=2" /><link rel="alternate" type="text/html" href="http://gnillydev.blogspot.com/2007/10/yahoo-contact-import-class-in-c.html" title="Yahoo! Contact Import class in C#" /><author><name>gnilly boy</name><uri>http://www.blogger.com/profile/13219585280483286310</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>61</thr:total></entry><entry gd:etag="W/&quot;DEMHRXkyeyp7ImA9WB9RFUk.&quot;"><id>tag:blogger.com,1999:blog-6592213425232326503.post-4153365628062160449</id><published>2007-10-16T07:46:00.000-07:00</published><updated>2007-10-16T07:53:54.793-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-10-16T07:53:54.793-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="min-width" /><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="max-height" /><category scheme="http://www.blogger.com/atom/ns#" term="Internet Explorer" /><category scheme="http://www.blogger.com/atom/ns#" term="min-height" /><category scheme="http://www.blogger.com/atom/ns#" term="max-width" /><category scheme="http://www.blogger.com/atom/ns#" term="css" /><title>min-width, min-height, max-width, max-height style properties in IE</title><content type="html">Before I was using IE expression to implement min-width in IE like Firefox. (Take a look at &lt;a href="http://www.gunlaug.no/contents/wd_additions_14.html"&gt;http://www.gunlaug.no/contents/wd_additions_14.html&lt;/a&gt;)&lt;br /&gt;But today I've found the best solution of min/max-width/height for IE.&lt;br /&gt;&lt;br /&gt;Just include reference to minmax.js script to your page and use min/max-width/height FF CSS styles.&lt;br /&gt;&lt;br /&gt;Script: &lt;a href="http://www.doxdesk.com/file/software/js/minmax.js"&gt;http://www.doxdesk.com/file/software/js/minmax.js&lt;/a&gt;&lt;br /&gt;Corresponding article: &lt;a href="http://www.doxdesk.com/software/js/minmax.html"&gt;http://www.doxdesk.com/software/js/minmax.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Thanks&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6592213425232326503-4153365628062160449?l=gnillydev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://gnillydev.blogspot.com/feeds/4153365628062160449/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6592213425232326503&amp;postID=4153365628062160449" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/4153365628062160449?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6592213425232326503/posts/default/4153365628062160449?v=2" /><link rel="alternate" type="text/html" href="http://gnillydev.blogspot.com/2007/10/min-width-min-height-max-width-max.html" title="min-width, min-height, max-width, max-height style properties in IE" /><author><name>gnilly boy</name><uri>http://www.blogger.com/profile/13219585280483286310</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry></feed>

