<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4739251876325953585</id><updated>2012-02-15T23:18:07.700-08:00</updated><title type='text'>ASP.NET Simple Samples</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://aspnet-simple-samples.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739251876325953585/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://aspnet-simple-samples.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>asp.net simple samples blog author's team</name><uri>http://www.blogger.com/profile/14305119557887279383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://2.bp.blogspot.com/_IXS2kuUxBsM/S0OiPriGBTI/AAAAAAAAAAY/RF9ti8Bs1eo/S220/%D0%AE%D0%BB%D1%8F+%D0%B8+%D0%96%D0%B5%D0%BD%D1%8F.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4739251876325953585.post-86897397145826706</id><published>2010-01-17T12:24:00.000-08:00</published><updated>2010-01-17T13:10:43.709-08:00</updated><title type='text'>Save cookie sample</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://rapidshare.com/files/336834229/SaveCookie.zip"&gt;&lt;img src="http://3.bp.blogspot.com/_IXS2kuUxBsM/S0JnEvaUYbI/AAAAAAAAAAM/M5y-v4xnb3E/s400/empty-button_long.jpg" alt="" id="BLOGGER_PHOTO_ID_5423010232451490226" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When a user visits your website, you can use cookies to store user login (storing a password is unsecure!) or user preferences or other information. When the user visits your Web site another time, the application can retrieve the information it stored earlier.&lt;br /&gt;&lt;br /&gt;This sample shows how to save cookie and how to retrive it when you visit site another time.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background: rgb(246, 248, 255) none repeat scroll 0% 0%; color: rgb(0, 0, 32); -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;protected&lt;/span&gt; &lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;void&lt;/span&gt; Page_Load&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;object&lt;/span&gt; sender&lt;span style="color: rgb(48, 128, 128);"&gt;,&lt;/span&gt; EventArgs e&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;{&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;Request&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Cookies&lt;span style="color: rgb(48, 128, 128);"&gt;[&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(16, 96, 182);"&gt;MyCookie&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;]&lt;/span&gt; &lt;span style="color: rgb(48, 128, 128);"&gt;!&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;null&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;br /&gt;     txtSavedCookie&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Text &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(16, 96, 182);"&gt;Cookie is: &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt; &lt;span style="color: rgb(48, 128, 128);"&gt;+&lt;/span&gt; Request&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Cookies&lt;span style="color: rgb(48, 128, 128);"&gt;[&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(16, 96, 182);"&gt;MyCookie&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;]&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Value&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;else&lt;/span&gt;&lt;br /&gt;     txtSavedCookie&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Text &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(16, 96, 182);"&gt;No cookies!&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;protected&lt;/span&gt; &lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;void&lt;/span&gt; btnSaveCookie_Click&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;object&lt;/span&gt; sender&lt;span style="color: rgb(48, 128, 128);"&gt;,&lt;/span&gt; EventArgs e&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;{&lt;/span&gt;&lt;br /&gt; HttpCookie cookie &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;new&lt;/span&gt; HttpCookie&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(16, 96, 182);"&gt;MyCookie&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;,&lt;/span&gt; txtCookieValue&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Text&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;&lt;br /&gt; Response&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;AppendCookie&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;cookie&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; txtResult&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Text &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(16, 96, 182);"&gt;Cookie saved!! Close this site and open it again - you will see saved cookie value at the top of this page!&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;All our simple samples available as Microsoft Visual Studio 2008 website projects.&lt;br /&gt;You can &lt;a href="http://rapidshare.com/files/336834229/SaveCookie.zip"&gt;&lt;span style="font-weight: bold;"&gt;DOWNLOAD&lt;/span&gt;&lt;/a&gt; this Save cookie sample project from Rapidshare.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739251876325953585-86897397145826706?l=aspnet-simple-samples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspnet-simple-samples.blogspot.com/feeds/86897397145826706/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://aspnet-simple-samples.blogspot.com/2010/01/save-cookie-sample.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739251876325953585/posts/default/86897397145826706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739251876325953585/posts/default/86897397145826706'/><link rel='alternate' type='text/html' href='http://aspnet-simple-samples.blogspot.com/2010/01/save-cookie-sample.html' title='Save cookie sample'/><author><name>asp.net simple samples blog author's team</name><uri>http://www.blogger.com/profile/14305119557887279383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://2.bp.blogspot.com/_IXS2kuUxBsM/S0OiPriGBTI/AAAAAAAAAAY/RF9ti8Bs1eo/S220/%D0%AE%D0%BB%D1%8F+%D0%B8+%D0%96%D0%B5%D0%BD%D1%8F.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_IXS2kuUxBsM/S0JnEvaUYbI/AAAAAAAAAAM/M5y-v4xnb3E/s72-c/empty-button_long.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739251876325953585.post-3612790621628283388</id><published>2010-01-17T11:44:00.000-08:00</published><updated>2010-01-17T12:22:20.498-08:00</updated><title type='text'>DateTime sample</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://rapidshare.com/files/336843330/DateTime.zip"&gt;&lt;img src="http://3.bp.blogspot.com/_IXS2kuUxBsM/S0JnEvaUYbI/AAAAAAAAAAM/M5y-v4xnb3E/s400/empty-button_long.jpg" alt="" id="BLOGGER_PHOTO_ID_5423010232451490226" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you want to display current date or time on the website you can use &lt;a href="http://msdn.microsoft.com/en-us/library/system.datetime.now.aspx"&gt;DateTime.Now&lt;/a&gt; property.&lt;br /&gt;This sample shows how to display it using 5 different formats.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background: rgb(246, 248, 255) none repeat scroll 0% 0%; color: rgb(0, 0, 32); -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;protected&lt;/span&gt; &lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;void&lt;/span&gt; Page_Load&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;object&lt;/span&gt; sender&lt;span style="color: rgb(48, 128, 128);"&gt;,&lt;/span&gt; EventArgs e&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(64, 96, 128);"&gt;{&lt;/span&gt;&lt;br /&gt;     Label1&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Text &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; DateTime&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Now&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;DayOfWeek&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;ToString&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;&lt;span style="color: rgb(89, 89, 121);"&gt;//return the current day of week&lt;/span&gt;&lt;br /&gt;     Label2&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Text &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; DateTime&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Now&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;ToLongDateString&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;  &lt;span style="color: rgb(89, 89, 121);"&gt;//return the "long date"&lt;/span&gt;&lt;br /&gt;     Label3&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Text &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; DateTime&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Now&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;ToShortDateString&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt; &lt;span style="color: rgb(89, 89, 121);"&gt;//return the "short date"&lt;/span&gt;&lt;br /&gt;     Label4&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Text &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; DateTime&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Now&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;ToLongTimeString&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;  &lt;span style="color: rgb(89, 89, 121);"&gt;//return the "long time"&lt;/span&gt;&lt;br /&gt;     Label5&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Text &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; DateTime&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Now&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;ToShortTimeString&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt; &lt;span style="color: rgb(89, 89, 121);"&gt;//return the "short time"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color: rgb(64, 96, 128);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;All our simple samples available as Microsoft Visual Studio 2008 website projects.&lt;br /&gt;You can &lt;a href="http://rapidshare.com/files/336843330/DateTime.zip"&gt;&lt;span style="font-weight: bold;"&gt;DOWNLOAD&lt;/span&gt;&lt;/a&gt; this DateTime sample project from Rapidshare.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739251876325953585-3612790621628283388?l=aspnet-simple-samples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspnet-simple-samples.blogspot.com/feeds/3612790621628283388/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://aspnet-simple-samples.blogspot.com/2010/01/datetime-sample.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739251876325953585/posts/default/3612790621628283388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739251876325953585/posts/default/3612790621628283388'/><link rel='alternate' type='text/html' href='http://aspnet-simple-samples.blogspot.com/2010/01/datetime-sample.html' title='DateTime sample'/><author><name>asp.net simple samples blog author's team</name><uri>http://www.blogger.com/profile/14305119557887279383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://2.bp.blogspot.com/_IXS2kuUxBsM/S0OiPriGBTI/AAAAAAAAAAY/RF9ti8Bs1eo/S220/%D0%AE%D0%BB%D1%8F+%D0%B8+%D0%96%D0%B5%D0%BD%D1%8F.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_IXS2kuUxBsM/S0JnEvaUYbI/AAAAAAAAAAM/M5y-v4xnb3E/s72-c/empty-button_long.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739251876325953585.post-1876221093294177074</id><published>2010-01-08T13:53:00.000-08:00</published><updated>2010-01-17T13:11:55.158-08:00</updated><title type='text'>String trim sample</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://rapidshare.com/files/332394570/StringTrim.zip"&gt;&lt;img src="http://3.bp.blogspot.com/_IXS2kuUxBsM/S0JnEvaUYbI/AAAAAAAAAAM/M5y-v4xnb3E/s400/empty-button_long.jpg" alt="" id="BLOGGER_PHOTO_ID_5423010232451490226" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you need to trim string and remove extra spaces from the middle of the string&lt;br /&gt;you can use this simple sample:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background: rgb(246, 248, 255) none repeat scroll 0% 0%; color: rgb(0, 0, 32); -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;string&lt;/span&gt; s &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; TextBox1&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Text&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;&lt;br /&gt;s &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; s&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Trim&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;                        &lt;span style="color: rgb(89, 89, 121);"&gt;// trim left and right spaces&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;while&lt;/span&gt; &lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;s&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;IndexOf&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(16, 96, 182);"&gt;  &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt; &lt;span style="color: rgb(48, 128, 128);"&gt;!&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(48, 128, 128);"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0, 140, 0);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;        &lt;span style="color: rgb(89, 89, 121);"&gt;// it is 2 spaces in the quotes!!&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;{&lt;/span&gt;&lt;br /&gt; s &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; s&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Remove&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;s&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;IndexOf&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(16, 96, 182);"&gt;  &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;,&lt;/span&gt; &lt;span style="color: rgb(0, 140, 0);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;   &lt;span style="color: rgb(89, 89, 121);"&gt;// remove extra spaces in the middle of the string&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Label1&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Text &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; s&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;It will take any input string from the TextBox1, i.e. like this:&lt;br /&gt;&lt;br /&gt;"___aaa_______bbb_________ccc_ddd__eee_",&lt;br /&gt;&lt;br /&gt;where "_" is a space symbol, and trim it to the:&lt;br /&gt;&lt;br /&gt;"aaa_bbb_ccc_ddd_eee".&lt;br /&gt;&lt;br /&gt;All our simple samples available as Microsoft Visual Studio 2008 website projects.&lt;br /&gt;You can &lt;a href="http://rapidshare.com/files/332394570/StringTrim.zip"&gt;&lt;span style="font-weight: bold;"&gt;DOWNLOAD&lt;/span&gt;&lt;/a&gt; this String trim sample project from Rapidshare.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739251876325953585-1876221093294177074?l=aspnet-simple-samples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspnet-simple-samples.blogspot.com/feeds/1876221093294177074/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://aspnet-simple-samples.blogspot.com/2010/01/string-trim-sample.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739251876325953585/posts/default/1876221093294177074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739251876325953585/posts/default/1876221093294177074'/><link rel='alternate' type='text/html' href='http://aspnet-simple-samples.blogspot.com/2010/01/string-trim-sample.html' title='String trim sample'/><author><name>asp.net simple samples blog author's team</name><uri>http://www.blogger.com/profile/14305119557887279383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://2.bp.blogspot.com/_IXS2kuUxBsM/S0OiPriGBTI/AAAAAAAAAAY/RF9ti8Bs1eo/S220/%D0%AE%D0%BB%D1%8F+%D0%B8+%D0%96%D0%B5%D0%BD%D1%8F.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_IXS2kuUxBsM/S0JnEvaUYbI/AAAAAAAAAAM/M5y-v4xnb3E/s72-c/empty-button_long.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739251876325953585.post-6333937057788587631</id><published>2010-01-04T13:21:00.000-08:00</published><updated>2010-01-17T13:13:04.403-08:00</updated><title type='text'>File upload sample</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://rapidshare.com/files/332385467/FileUpload.zip"&gt;&lt;img src="http://3.bp.blogspot.com/_IXS2kuUxBsM/S0JnEvaUYbI/AAAAAAAAAAM/M5y-v4xnb3E/s400/empty-button_long.jpg" alt="" id="BLOGGER_PHOTO_ID_5423010232451490226" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In ASP.NET websites you can upload file on server using the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx"&gt;FileUpload web UI control&lt;/a&gt;.&lt;br /&gt;(You can drag and drop the control from the Toolbox on the Web page in Design mode.)&lt;br /&gt;&lt;span&gt;The user specifies the file to upload by &lt;/span&gt;&lt;span&gt;selecting the file by clicking the &lt;span class="label"&gt;Browse&lt;/span&gt; button, and then locating it in the &lt;span class="label"&gt;Choose File&lt;/span&gt; dialog box&lt;/span&gt;&lt;span&gt;.&lt;br /&gt;&lt;/span&gt;&lt;span&gt;The &lt;span&gt;&lt;span class="selflink"&gt;FileUpload&lt;/span&gt;&lt;/span&gt; control does not automatically save a file to the server after the user selects the file to upload.&lt;/span&gt;&lt;span&gt; You must provide a button that the user clicks to upload the file, in our sample it will be "Upload" button. Here is a code of the Upload button handler from our sample:&lt;br /&gt;&lt;pre style="background: rgb(246, 248, 255) none repeat scroll 0% 0%; color: rgb(0, 0, 32); -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;FileUpload1&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;HasFile&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;                          &lt;span style="color: rgb(89, 89, 121);"&gt;//  check whether the selected file&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;string&lt;/span&gt; path &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; @"C&lt;span style="color: rgb(48, 128, 128);"&gt;:&lt;/span&gt;\Received Files\"&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;             &lt;span style="color: rgb(89, 89, 121);"&gt;//  This specifies the path to the destination&lt;/span&gt;&lt;br /&gt;path &lt;span style="color: rgb(48, 128, 128);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; FileUpload1&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;FileName&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;                    &lt;span style="color: rgb(89, 89, 121);"&gt;//  add the file name to the path&lt;/span&gt;&lt;br /&gt;FileUpload1&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;PostedFile&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;SaveAs&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;path&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;             &lt;span style="color: rgb(89, 89, 121);"&gt;//  ... and save&lt;/span&gt;&lt;br /&gt;Label1&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Text &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; FileUpload1&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;PostedFile&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;ContentLength&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;ToString&lt;span style="color: rgb(48, 128, 128);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(48, 128, 128);"&gt;)&lt;/span&gt; &lt;span style="color: rgb(48, 128, 128);"&gt;+&lt;/span&gt; &lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(16, 96, 182);"&gt; Bytes saved&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 0, 128); font-weight: bold;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;{&lt;/span&gt;&lt;br /&gt;Label1&lt;span style="color: rgb(48, 128, 128);"&gt;.&lt;/span&gt;Text &lt;span style="color: rgb(48, 128, 128);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(16, 96, 182);"&gt;You have not selected a file to upload&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(64, 96, 128);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;All our simple samples available as Microsoft Visual Studio 2008 website projects.&lt;br /&gt;You can &lt;a href="http://rapidshare.com/files/332385467/FileUpload.zip"&gt;&lt;span style="font-weight: bold;"&gt;DOWNLOAD&lt;/span&gt;&lt;/a&gt; this File upload sample project from Rapidshare.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739251876325953585-6333937057788587631?l=aspnet-simple-samples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspnet-simple-samples.blogspot.com/feeds/6333937057788587631/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://aspnet-simple-samples.blogspot.com/2010/01/file-upload-sample.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739251876325953585/posts/default/6333937057788587631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739251876325953585/posts/default/6333937057788587631'/><link rel='alternate' type='text/html' href='http://aspnet-simple-samples.blogspot.com/2010/01/file-upload-sample.html' title='File upload sample'/><author><name>asp.net simple samples blog author's team</name><uri>http://www.blogger.com/profile/14305119557887279383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://2.bp.blogspot.com/_IXS2kuUxBsM/S0OiPriGBTI/AAAAAAAAAAY/RF9ti8Bs1eo/S220/%D0%AE%D0%BB%D1%8F+%D0%B8+%D0%96%D0%B5%D0%BD%D1%8F.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_IXS2kuUxBsM/S0JnEvaUYbI/AAAAAAAAAAM/M5y-v4xnb3E/s72-c/empty-button_long.jpg' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
