<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://dotnetslackers.com/Community/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Haissam [MCAD]</title><subtitle type="html">Posting Technical problems/solutions through out my personal experience</subtitle><id>http://dotnetslackers.com/Community/blogs/haissam/atom.aspx</id><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/default.aspx" /><link rel="self" type="application/atom+xml" href="http://dotnetslackers.com/Community/blogs/haissam/atom.aspx" /><generator uri="http://communityserver.org" version="3.1.30415.43">Community Server</generator><updated>2007-12-26T19:17:00Z</updated><entry><title>Authenticate Users Via POST request</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/05/19/authenticate-users-via-post-request.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/05/19/authenticate-users-via-post-request.aspx</id><published>2008-05-19T05:32:00Z</published><updated>2008-05-19T05:32:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;In this blog post,&amp;nbsp; I will explain how to submit user credentials to another application to authenticate users.&lt;/p&gt;
&lt;p&gt;Suppose in your application, you wanted to retrieve data from another application (for instance RSS feeds), this rss feed isn&amp;#39;t for public use, and you don&amp;#39;t control the login authentication on that application.&lt;/p&gt;
&lt;p&gt;Solution&lt;br /&gt;You can submit user credentials from your application to the other application and process the login click event using the HttpWebRequest class. In this way, if the user is authenticated&amp;nbsp; the authentication cookie will be saved in the response header. After this stage, Each time you want to retrieve information for Application B, you could set the authentication cookie already retrieved to the request header so Application B will deal with the request as an authenticated one.&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s drill down to the code&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string loginURL = &amp;quot;&lt;a href="http://www.example.com/default.aspx"&gt;http://www.example.com/default.aspx&lt;/a&gt;&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create a webrequest to the above url &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HttpWebRequest webRequest = WebRequest.Create(loginURL) as HttpWebRequest;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set the request method to post&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; webRequest.Method = WebRequestMethods.Http.Post;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; webRequest.AllowAutoRedirect = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set the content type to urlencoded&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; webRequest.ContentType = &amp;quot;application/x-www-form-urlencoded&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set the data which needs to be posted. Note here os_username, os_password is the textbox ID for the&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //username, password on Application B. login is the ID of the login button control, LogIn is its value.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string postData = &amp;quot;os_username=haissam&amp;amp;os_password=password&amp;amp;login=LogIn&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set the content length of the request&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; webRequest.ContentLength = postData.Length;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // set the webrequest stream to the requestWriter &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StreamWriter requestWriter = new StreamWriter(webRequest.GetRequestStream());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Write the data which need to be posted to the streamwriter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; requestWriter.Write(postData);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Close the stream&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; requestWriter.Close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // you don&amp;#39;t need to get the response only the authentication cookie so directly we close it&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; webRequest.GetResponse().Close();&lt;/p&gt;
&lt;p&gt;Hope this helps,&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=26791" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>Exam 70-315 Preparation Guide [UCertify]</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/04/29/exam-70-315-preparation-guide-ucertify.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/04/29/exam-70-315-preparation-guide-ucertify.aspx</id><published>2008-04-29T06:48:00Z</published><updated>2008-04-29T06:48:00Z</updated><content type="html">&lt;p&gt;In this blog post, I will write a review on the 70-315 (Developing and Implementing Web Applications with MS visual C# and MS VS.NET) exam provided by &lt;a class="" href="http://www.ucertify.com/" target="_blank"&gt;UCertify.com.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The importance of preparation exams:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;After you finish reading all the materials required for 70-315 exam, it is recommended to take a practice test before the official one. The practice test provided by Ucertify.com will give you an excellent idea about the type of questions you will face and prepare you both technically and mentally in order to pass the exam from the first try.&lt;/p&gt;
&lt;p&gt;Before starting the test, it is recommended to read the exam objectives. After that, take a look into the Study Tips which, in my opinion, gives you a proper orientation about Microsoft exams and how to be fully prepared especially if it was the first exam you are taking.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Taking the test:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;This will help you identify your weakness in order to enable you to focus on these topics. Each test you take is provided with a count down timer. This timer resembles to the timer provided in the real exam in this way, you can be sure that you will finish all the questions before you are running out of time.&amp;nbsp; Taking advantage of the “Test History” using UCertify.com exam preparation will give you a better visual idea about each test you took, percentage of the questions answered, and the most important property is the “Remark” column in which you can check their remarks on each test. &lt;/p&gt;
&lt;p&gt;One tip to consider during the exam is to take the questions that you can answer easily and mark the hard questions to be reviewed later. Using this technique will help you &lt;/p&gt;
&lt;p&gt;1-&amp;nbsp;Answering as much questions as you can&lt;br /&gt;2-&amp;nbsp;Refreshing your mind maybe later you could find the proper answer.&lt;/p&gt;
&lt;p&gt;Make sure also to review the explanation of both correct and incorrect answers to ensure better understanding and learning.&lt;br /&gt;Another cool feature is the Learning mode while taking the exam which enables you to get a feedback of the question before taking the next one.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Questions Engine:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;In a technical point of view and considering the fact that I already passed this exam, I can say that the questions provided are efficient, cover all the topics required, and resemble to the actual exam questions. Much more, the tests seem to be harder than the official one which is good in this case because it guarantees that you will pass the actual exam.&lt;br /&gt;Each required topic has its own set of questions, once you identify your weakness you can create a custom test to focus on this topic. &lt;/p&gt;
&lt;p&gt;N.B: Make sure to update frequently the questions by going to File/Update PrepEngine.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br /&gt;&amp;nbsp;The idea is not just passing the actual exam; of course it is our main goal but also to improve our skills and ensure that we fully understand all the required topics which I think UCertify.com made it easy on us!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;UCertify is making a 10% discount for all my blog readers. To get this discount, you can use the &amp;quot;HMALAK&amp;quot; discount code.&lt;br /&gt;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=26527" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>Top 3 Blog Posts</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/04/11/top-3-blog-posts.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/04/11/top-3-blog-posts.aspx</id><published>2008-04-11T09:58:00Z</published><updated>2008-04-11T09:58:00Z</updated><content type="html">&lt;p&gt;In this blog post, i will share my top 3 blog posts made during last year.&amp;nbsp;It is&amp;nbsp;a good way to monitor which blog post has the highest&amp;nbsp;number of views and comments to better understand which topic(s) concerns web developers more.&lt;/p&gt;
&lt;p&gt;1- &lt;a class="" title="Pass data between parent &amp;amp; child window" href="http://dotnetslackers.com/community/blogs/haissam/archive/2007/04/03/Passing-Data-Between-Parent-and-Child-window.aspx" target="_blank"&gt;Passing Data Between Parent and Child window&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;Views: 17442.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Comments: 43&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;2- &lt;a class="" title="Close window without the promt message IE7" href="http://dotnetslackers.com/community/blogs/haissam/archive/2007/04/20/Javascript_3A00_-Close-window-without-the-prompt-message-in-IE7.aspx" target="_blank"&gt;Close window without the prompt message in IE7&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;Views: 13978&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Comments: 50&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;3- &lt;a class="" title="Download Files in ASP.NET" href="http://dotnetslackers.com/community/blogs/haissam/archive/2007/04/03/Downloading-Files-C_2300_.aspx" target="_blank"&gt;Downloading Files C#&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;Views: 12319&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Comments: 53&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Haissam Abdul Malak&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=26364" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>Upload Multiple Files Using ASP.NET &amp; Adobe Flex</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/03/29/upload-multiple-files-using-asp-net-amp-adobe-flex.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="246159" href="http://dotnetslackers.com/Community/blogs/haissam/attachment/26231.ashx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/03/29/upload-multiple-files-using-asp-net-amp-adobe-flex.aspx</id><published>2008-03-29T17:08:00Z</published><updated>2008-03-29T17:08:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;In this blog post, Haissam Abdul Malak will demonstrate how to upload multiple files in ASP.NET taking advantage of Adobe Flex technology.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;text-decoration:underline;"&gt;Why The integration between Flex and ASP.NET&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Using the File Upload control provided in ASP.NET, the user can&amp;#39;t select more than 1 file at a time however in Adobe Flex the user can select multiple files in the open dialog box through the &lt;br /&gt;FileReferenceList.browse() method also one important feature to mention is the ability to monitor the upload progress. In other words, you can handle the Progress event to display the number of bytes being uploaded and the total size of each uploaded file.&lt;/p&gt;&lt;p&gt;After the user selects the files, you can access them by the fileReferenceList.fileList property which will return an Array of the selected files. In this way, You can loop through the array&amp;#39;s elements and start the upload process for each file. To successfully upload a file, you need to send a &amp;quot;Post&amp;quot; request to a URL (the handler will be an aspx page) which will save the files in the application root folder.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;text-decoration:underline;"&gt;Creating the Flex Application&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you have a Adobe Flex builder, you can open it and click on File --&amp;gt; New --&amp;gt; Flex Project.&lt;br /&gt;&lt;br /&gt;An .mxml file will be created, Just copy and paste the below code&lt;br /&gt;&lt;br /&gt;&lt;span style="text-decoration:underline;"&gt;MXML:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;mx:Application xmlns:mx=&amp;quot;http://www.adobe.com/2006/mxml&amp;quot; layout=&amp;quot;absolute&amp;quot; creationComplete=&amp;quot;myFunction();&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;mx:Button x=&amp;quot;10&amp;quot; y=&amp;quot;10&amp;quot; label=&amp;quot;Choose Files&amp;quot; id=&amp;quot;btnSelectFiles&amp;quot;/&amp;gt;&lt;br /&gt;&amp;lt;mx:Button x=&amp;quot;114&amp;quot; y=&amp;quot;10&amp;quot; label=&amp;quot;Upload&amp;quot; id=&amp;quot;btnUpload&amp;quot; visible=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;&amp;lt;mx:Label x=&amp;quot;10&amp;quot; y=&amp;quot;208&amp;quot; width=&amp;quot;100%&amp;quot; id=&amp;quot;lblFileName&amp;quot; fontWeight=&amp;quot;bold&amp;quot;/&amp;gt;&lt;br /&gt;&amp;lt;mx:List borderStyle=&amp;quot;none&amp;quot; backgroundAlpha=&amp;quot;0&amp;quot; x=&amp;quot;10&amp;quot; y=&amp;quot;40&amp;quot; width=&amp;quot;30%&amp;quot; id=&amp;quot;listSelectedFiles&amp;quot; visible=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;mx:Label x=&amp;quot;10&amp;quot; y=&amp;quot;234&amp;quot; width=&amp;quot;100%&amp;quot; id=&amp;quot;lblUploadedBytes&amp;quot; fontWeight=&amp;quot;bold&amp;quot;/&amp;gt;&lt;br /&gt;&amp;lt;mx:Label x=&amp;quot;10&amp;quot; y=&amp;quot;260&amp;quot;&amp;nbsp; width=&amp;quot;100%&amp;quot; id=&amp;quot;lblTotalBytes&amp;quot; fontWeight=&amp;quot;bold&amp;quot;/&amp;gt;&lt;br /&gt;&amp;lt;mx:Script&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;![CDATA[&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;import mx.messaging.AbstractConsumer;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;public var fileReferenceList:FileReferenceList = new FileReferenceList();&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;public function eventResponse(Event:MouseEvent):void&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Set the file filters in the open dialog box&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var typeFiler:FileFilter = new FileFilter(&amp;quot;All&amp;quot;,&amp;quot;*.*&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// show the dialog box&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;fileReferenceList.browse([typeFiler]);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;public function selectResponse(event:Event):void&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Create an array with the size of the selected files.&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var filesSelected:Array = new Array(fileReferenceList.fileList.length);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Loop through all the selected files and add their names to the List control &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for(var i:int=0;i&amp;lt;fileReferenceList.fileList.length;i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var fileReference:FileReference = fileReferenceList.fileList[ i ];&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;filesSelected[ i ] = fileReference.name;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;listSelectedFiles.dataProvider = filesSelected;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;listSelectedFiles.visible = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;btnUpload.visible = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;public function myFunction(): void&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// This function is called on creationComplete event of this application&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Add event handler for the mouse click on the selectFiles button&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;btnSelectFiles.addEventListener(MouseEvent.CLICK, eventResponse);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Add event handler for the mouse click on the upload button&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;btnUpload.addEventListener(MouseEvent.CLICK, btnUploadResponse);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Add event handler for the select action in the open file dialog box&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;fileReferenceList.addEventListener(Event.SELECT,selectResponse);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;public function UploadFiles():void&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// If the user selected 1 or multiple files&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(fileReferenceList.fileList.length &amp;gt; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// For each file selected&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for(var i:int=0;i&amp;lt;fileReferenceList.fileList.length;i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Create a FileReference instance of each file&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var fileReference:FileReference = fileReferenceList.fileList[ i ];&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Create a new URLRequest class: The parameter is the aspx handler page&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var request:URLRequest = new URLRequest(&amp;quot;http://localhost/FlexUpload/Default.aspx&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Add event handler for the progress &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;fileReference.addEventListener(ProgressEvent.PROGRESS, progressStatus);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Set the content type&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;request.contentType = &amp;quot;application/octet-stream&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Set the method of the request&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;request.method = &amp;quot;POST&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Upload the file&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;fileReference.upload(request,fileReference.name,false);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;public function btnUploadResponse(event:Event):void&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Disable the Select files button, upload button, and call the UploadFiles function&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;btnSelectFiles.enabled = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;btnUpload.enabled = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;UploadFiles();&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;public function progressStatus(event:ProgressEvent):void&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var file:FileReference = FileReference(event.target);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Set the name of the currently being uploaded file&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;lblFileName.text = &amp;quot;Uploading File: &amp;quot; + file.name;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Set the number of bytes being uploaded&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;lblUploadedBytes.text = &amp;quot;Bytes Uploaded: &amp;quot; + event.bytesLoaded;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Set the total number of bytes&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;lblTotalBytes.text = &amp;quot;Total Size: &amp;quot; + event.bytesTotal + &amp;quot; bytes&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;]]&amp;gt;&lt;br /&gt;&amp;lt;/mx:Script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/mx:Application&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;text-decoration:underline;"&gt;ASP.NET Application&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I decided to post the above code in case anyone wants to change the UI or some functionality of this control. However, if you want to use it as it is, All you need to do is to embed the &amp;quot;.swf&amp;quot; using the &lt;br /&gt;&lt;br /&gt;Object tag file found in the attached zip file of this current post into your application. &lt;br /&gt;Now create a folder &amp;quot;UploadedFiles&amp;quot; which will contain all the uploaded files (do not forget to give IUSR_&amp;lt;machinename&amp;gt; read/write permissions).&lt;br /&gt;&lt;br /&gt;After this stage, you need to create a page called &amp;quot;UploadHandler.aspx&amp;quot; which will received the file and save it in the &amp;quot;UploadedFiles&amp;quot;. Copy the below into the page_load event&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; Request.Files.Count; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string fileName = System.IO.Path.GetFileName(Request.Files[ i ].FileName);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Request.Files[ i ].SaveAs(Server.MapPath(&amp;quot;~/UploadedFiles/&amp;quot;) + fileName);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After you complete the above steps, you can run the application and see how it functions.&lt;br /&gt;&lt;br /&gt;Hope this Helps,&lt;br /&gt;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=26231" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>Convert PDF to SWF in ASP.NET</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/03/14/convert-pdf-to-swf-in-asp-net.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/03/14/convert-pdf-to-swf-in-asp-net.aspx</id><published>2008-03-14T15:14:00Z</published><updated>2008-03-14T15:14:00Z</updated><content type="html">&lt;p&gt;I always wanted to guarantee that users of my application can view my published documents even if they don&amp;#39;t have the needed application installed on their machines. To achieve this requirement and MACROMEDIA FLASH being installed on almost every browser, i got to either build a tool to convert my PDF files to flash files or to use a free tool. I came across an excellent and effective tool called &lt;a class="" href="http://www.swftools.org/" target="_blank"&gt;SWFTOOLS&lt;/a&gt;. The beauty of this tool is that it can convert not just all the pdf file to swf file but it can convert a specific page also. In this way, i reduce the time needed to convert all the file and make it on demand. This tool can run using shell commands and using ASP.NET we can execute this process by using the System.Diagnostics.Process class. &lt;/p&gt;
&lt;p&gt;When you install this tool on your local machine, copy the &amp;quot;font&amp;quot; and the PDF2SWF.exe file into a folder in your application root folder &amp;quot;PDF2SWF&amp;quot; and use the below code&lt;/p&gt;
&lt;p&gt;int pageNumber = 1;&lt;br /&gt;string fileName = &amp;quot;Files/1.pdf&amp;quot;;&lt;/p&gt;
&lt;p&gt;System.Diagnostics.Process p = new System.Diagnostics.Process();&lt;/p&gt;
&lt;p&gt;p.StartInfo.UseShellExecute = false;&lt;/p&gt;
&lt;p&gt;p.StartInfo.RedirectStandardOutput = true;&lt;/p&gt;
&lt;p&gt;p.StartInfo.CreateNoWindow = true;&lt;/p&gt;
&lt;p&gt;p.StartInfo.RedirectStandardError = true;&lt;/p&gt;
&lt;p&gt;p.StartInfo.WorkingDirectory = HttpContext.Current.Server.MapPath(&amp;quot;~&amp;quot;);&lt;/p&gt;
&lt;p&gt;p.StartInfo.FileName = HttpContext.Current.Server.MapPath(&amp;quot;~/PDF2SWF/PDF2SWF.exe&amp;quot;);&lt;/p&gt;
&lt;p&gt;p.StartInfo.Arguments = &amp;quot;-F &amp;quot; + &amp;quot;\&amp;quot;&amp;quot; +HttpContext.Current.Server.MapPath(&amp;quot;~/PDF2SWF/FONTS&amp;quot;) + &amp;quot;\&amp;quot;&amp;quot; + &amp;quot; -p &amp;quot; + pageNumber + &amp;quot; &amp;quot; + fileName + &amp;quot; -o &amp;quot; + fileName + pageNumber + &amp;quot;.swf&amp;quot;;&lt;/p&gt;
&lt;p&gt;//Start the process&lt;/p&gt;
&lt;p&gt;p.Start();&lt;br /&gt;p.WaitForExit();&lt;br /&gt;p.Close();&lt;/p&gt;
&lt;p&gt;The above code will create an instance of the Process class, Set the working directory to the root application folder, set the filename to the exe file and send arguments to the process. you can check the tool&amp;#39;s website to know more about the arguments list.&lt;br /&gt;Now after the above code will finish executing, a new file called 11.swf will be saved in the folder which will you can use to display it in your webform.&lt;/p&gt;
&lt;p&gt;Hope this helps,&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=25561" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>My move to Athens</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/02/21/my-move-to-athens.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/02/21/my-move-to-athens.aspx</id><published>2008-02-21T17:15:00Z</published><updated>2008-02-21T17:15:00Z</updated><content type="html">&lt;p&gt;Well, I have been asked to move to Athens and work on a project in my company. It was a tough decision to make because i have to leave my country and try to live there for more than 3 months. I will try to keep my blog alive as well as for my contributions to the asp.net forums members.&lt;/p&gt;&lt;p&gt;Meanwhile, You can leave comments on any blog post i already made and i will try my best to answer it as soon as possible.&lt;/p&gt;&lt;p&gt;Regards,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=17512" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>Send Personalized Emails using System.Net.Mail</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/02/13/send-personalized-emails-using-system-net-mail.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/02/13/send-personalized-emails-using-system-net-mail.aspx</id><published>2008-02-13T17:56:00Z</published><updated>2008-02-13T17:56:00Z</updated><content type="html">&lt;p&gt;In this blog post, We will learn how to send personalized emails to our clients. At first, Just create a txt file called &amp;quot;MailTemplate.txt&amp;quot; in your application root folder containing the below &lt;/p&gt;&lt;p&gt;Dear &amp;lt;user&amp;gt;,&lt;/p&gt;&lt;p&gt;This is a test for the process of sending personalized emails taking advantage of the power of System.Net.Mail introduced in ASP.NET 2.0&lt;/p&gt;&lt;p&gt;Best Regards,&lt;/p&gt;&lt;p&gt;&amp;lt;company&amp;gt;&lt;/p&gt;&lt;p&gt;What we will do in the next section is to merge the above template with the MailMessage Class. (user and company will be replaced through our code).&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &amp;nbsp;&amp;nbsp;  &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Create a dictionary generic collection and add the values of user and company&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dictionary&amp;lt;string, string&amp;gt; d = new Dictionary&amp;lt;string,string&amp;gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d.Add(&amp;quot;&amp;lt;user&amp;gt;&amp;quot;,User.Identity.Name);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d.Add(&amp;quot;&amp;lt;company&amp;gt;&amp;quot;,&amp;quot;MyCompany&amp;quot;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Create instance of the MailDefinition Class&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MailDefinition md = new MailDefinition();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Set its Body file name to the template already created&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; md.BodyFileName = &amp;quot;MailTemplate.txt&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // use the CreateMailMessage function of the MailDefinition class to set the To, Collection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MailMessage ms = md.CreateMailMessage(&amp;quot;haissam50@hotmail.com&amp;quot;, d, new LiteralControl());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Set the from Property&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ms.From = new MailAddress(&amp;quot;haissam@haissam.com&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Set the subject&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ms.Subject = &amp;quot;Personalized Email&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Create an instance of the SmtpClient class&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SmtpClient sm = new SmtpClient();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Send the email&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sm.Send(ms);&lt;/p&gt;&lt;p&gt;Of course, you need to configure the Mail Settings in your web.config file.&lt;/p&gt;&lt;p&gt;Hope this helps&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=17250" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>MasterType directive in Content Page</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/02/11/mastertype-directive-in-content-page.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/02/11/mastertype-directive-in-content-page.aspx</id><published>2008-02-10T22:26:00Z</published><updated>2008-02-10T22:26:00Z</updated><content type="html">&lt;p&gt;In this blog post, An example will be provided to demonstrate the benefit of the MasterType directive.&lt;/p&gt;&lt;p&gt;Suppose we have a page associated with a master page. In the master page, we have a Label control (Label1) which we need to access its text property and change it from the content page. We create a public property in the master page called LabelText&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string LabelText&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return Label1.Text;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Label1.Text = value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;To gain access to the master page file in the content page, Add the below directive to the content page&lt;/p&gt;&lt;p&gt;&amp;lt;%@ MasterType VirtualPath=&amp;quot;~/MasterPage.master&amp;quot;%&amp;gt;&lt;/p&gt;&lt;p&gt;When ASP.NET realizes the existance of this directive, it generates a strongly typed property &amp;quot;Master&amp;quot;. this property will give you access to the MasterPage file. So directly in the content page code behind you would use the below instead of trying to use the FindControl method.  &lt;/p&gt;&lt;p&gt;Master.LabelText = &amp;quot;Testing the MasterType directive effect&amp;quot;; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Hope this helps&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=17181" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>HttpWebRequest Class</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/01/22/httpwebrequest-class.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/01/22/httpwebrequest-class.aspx</id><published>2008-01-22T17:34:00Z</published><updated>2008-01-22T17:34:00Z</updated><content type="html">&lt;p&gt;In this blog post, i will explain how we used the HttpWebRequest to retrieve a page which needs authentication. &lt;br /&gt;My colleague had an issue in which he needed to retrieve a specific quotes from http://finance.yahoo.com. Of course to be able to retrieve his own created table, he needs to authenticate using his yahoo credentials. My idea was to use HttpWebRequest class by sending the proper authentication cookie in its header which will guarantee the page retrieval.&lt;br /&gt;To retrieve the authenticated header cookie value, i used Fidler to intercept the request and response. After authentication was made, i looked at the filder and get the cookie value from the authenticated request header. In this way, if i added to the HttpWebRequest header collection the &amp;quot;Cookie&amp;quot; and its retrieved value, The web server will deal with my request as an authenticated one. &lt;br /&gt;&lt;br /&gt;Below is the implementation (Import System.Net and System.IO)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(&amp;quot;http://finance.yahoo.com/p?k=pf_1&amp;amp;d=v4&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; request.Proxy.Credentials = CredentialCache.DefaultCredentials;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; request.Headers.Add(&amp;quot;Cookie&amp;quot;, &amp;quot;TheEncryptedValueRetrieved&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HttpWebResponse response = (HttpWebResponse)request.GetResponse();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (StreamReader sr = new StreamReader(response.GetResponseStream()))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string strResult = sr.ReadToEnd();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StreamWriter sw = new StreamWriter(Server.MapPath(&amp;quot;~/test.html&amp;quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sw.WriteLine(strResult);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Close StreamWriter and StreamReader&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr.Close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sw.Close();&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Redirect(&amp;quot;test.html&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch(Exception ex)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Response.Write(ex.Message);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;N.B: In my network, Internet access is under a proxy server which was displaying &amp;quot;The remote server returned an error: (407) Proxy Authentication Required.&amp;quot;. To fix this issue, i had to add request.Proxy.Credentials = CredentialCache.DefaultCredentials; to the request object which will set the proxy credentials to the default one already configured.&lt;br /&gt;&lt;br /&gt;The Encrypted value of the Cookie is replaced in this example by &amp;quot;TheEncryptedValueRetrieved&amp;quot; for security purpose.&lt;br /&gt;&lt;br /&gt;Hope this helps&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=15612" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>Cross Page Posting &amp; Validation</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/01/22/cross-page-posting-amp-validation.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/01/22/cross-page-posting-amp-validation.aspx</id><published>2008-01-22T08:58:00Z</published><updated>2008-01-22T08:58:00Z</updated><content type="html">&lt;p&gt;&lt;br /&gt;Server side validation will be ignored in case you are using the Cross Page Posting feature in ASP.NET 2.0 and therefore you can&amp;#39;t know what was the user input. However on the redirected page, you can still check the previous page IsValid method. In such&amp;nbsp; scenario, if the IsValid property of the previous page is false, you can redirect the user back to the previous page but all the input fields will be losing their data because like you might know the ViewState is not maintained.&lt;/p&gt;
&lt;p&gt;Below is code implementation:&lt;/p&gt;
&lt;p&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;if(!PreviousPage.IsValid)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;Server.Transfer(&amp;quot;Default.aspx&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;// Execute the code &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;HC&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=15551" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>Display Legend In Panel Control</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/01/17/display-legend-in-panel-control.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/01/17/display-legend-in-panel-control.aspx</id><published>2008-01-16T22:31:00Z</published><updated>2008-01-16T22:31:00Z</updated><content type="html">&lt;p&gt;How many of you used group box control when developing Desktop Applications! I used them to group controls on a specific form in a logical more organized way with titles. Now in ASP.NET 2.0 and using Panel web server control, this can be achieved. Below is a sample HTML to demonstrate it &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;asp:Panel ID=&amp;quot;Panel1&amp;quot; runat=&amp;quot;server&amp;quot; Width=&amp;quot;100%&amp;quot; Height=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt; &amp;lt;fieldset&amp;gt;&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&amp;lt;legend&lt;/b&gt; id=&amp;quot;pnlLegend&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Welcome&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&amp;lt;/legend&amp;gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/fieldset&amp;gt;&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/asp:Panel&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Adding the fieldset control inside the panel will allow us to add legend to it.&lt;/p&gt;&lt;p&gt;Once you copy this HTML into the Source, go back to the Design mode and check it up. &lt;/p&gt;&lt;p&gt;Don&amp;#39;t forget you can treat legend now as a normal html control which can be transformed into HTML server control by adding runat=&amp;quot;server&amp;quot; and id=&amp;quot;pnlLegend&amp;quot; to set its text from code behind : &lt;b&gt;pnlLegend.InnerText = &amp;quot;Hello World&amp;quot;;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=14619" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>First Operating System in C#</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/01/04/first-operating-system-in-c.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/01/04/first-operating-system-in-c.aspx</id><published>2008-01-04T14:32:00Z</published><updated>2008-01-04T14:32:00Z</updated><content type="html">&lt;p&gt;&lt;em&gt;&lt;font size="2"&gt;The &lt;/font&gt;&lt;/em&gt;&lt;font color="#5e741c" size="2"&gt;&lt;em&gt;SharpOS&lt;/em&gt;&lt;/font&gt;&lt;em&gt;&lt;font size="2"&gt; project is &lt;/font&gt;&lt;/em&gt;&lt;font color="#5e741c" size="2"&gt;&lt;em&gt;aimed at writing an operating system in 100% C#&lt;/em&gt;&lt;/font&gt;&lt;em&gt;&lt;font size="2"&gt;. &lt;/font&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;font size="2"&gt;Check out more about it in the below link&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.osnews.com/story.php/19100/SharpOS-Releases-First-Milestone"&gt;http://www.osnews.com/story.php/19100/SharpOS-Releases-First-Milestone&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/em&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=12614" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>Weak References in .NET [C#]</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/01/03/weak-references-in-net-c.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/01/03/weak-references-in-net-c.aspx</id><published>2008-01-03T18:56:00Z</published><updated>2008-01-03T18:56:00Z</updated><content type="html">&lt;p&gt;Just to refresh our minds about strong references before starting to talk about weak references.A reference pointing to an object created by the new operator is called a &lt;b&gt;Strong Reference&lt;/b&gt; and as long as this reference is still pointing to that object it will reside in memory. However, if a weak reference points to an object it gets collected by the garbage collector as soon as &lt;b&gt;more memory is in need&lt;/b&gt;.&lt;/p&gt;&lt;p&gt;&lt;u&gt;&lt;b&gt;When to use Weak references?&lt;/b&gt;&lt;/u&gt;&lt;/p&gt;&lt;p&gt;For example, if you have data (not critical for your application) to be retrieved from an xml file, text file, or even a data source then you could use a weak reference. Even if it get collected by the garbage&amp;nbsp; collector you can still re-process the data.&lt;/p&gt;&lt;p&gt;&amp;nbsp;Below is a sample code to get a weak reference out of a strong one.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create new strong reference to an object&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Xml.XmlDocument doc = new System.Xml.XmlDocument();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Load the xml into that object&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; doc.Load(Server.MapPath(&amp;quot;~/test.xml&amp;quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create weak reference out of doc object&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WeakReference docWeakRef = new WeakReference(doc);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set the doc object to null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; doc = null;&lt;/p&gt;&lt;p&gt;Now you can still get the strong reference to that object before using &lt;/p&gt;&lt;p&gt;docWeakRef.Target // which returns a strong reference to the weak object&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;i&gt;Just remember before using the object always check the Target property if it is null then the object has been collected by the garbage collector and of course removed from the memory.&lt;/i&gt;&lt;/p&gt;&lt;p&gt;Happy Coding!&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=12559" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>Exception Management in .NET</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/01/03/exception-management-in-net.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2008/01/03/exception-management-in-net.aspx</id><published>2008-01-03T07:59:00Z</published><updated>2008-01-03T07:59:00Z</updated><content type="html">&lt;p&gt;I just want to share with you the below excellent article ( best practices ) to go deeply on how to handle exceptions in your application whether it was a windows application, web application or even a webservice.&lt;/p&gt;
&lt;p&gt;&lt;a class="" title="Exception Management" href="http://msdn2.microsoft.com/en-us/library/ms954599.aspx" target="_blank"&gt;Exception Management in .NET&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Happy Coding!&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=12526" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry><entry><title>Integrating Adobe Flex Application inside ASP.NET application</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/haissam/archive/2007/12/26/integrating-adobe-flex-application-inside-asp-net-application.aspx" /><id>http://dotnetslackers.com/Community/blogs/haissam/archive/2007/12/26/integrating-adobe-flex-application-inside-asp-net-application.aspx</id><published>2007-12-26T16:17:00Z</published><updated>2007-12-26T16:17:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;I have been working a little bit with Adobe Flex Builder to create flex applications. I really found the UI very rich and lots of functionalities can be developed using flex. Most powerful feature i used is to allow the .NET webservice to communicate with my flex application. As i&amp;#39;m a .NET developer, i used the power of webservices to retrieve data from SQL in which this webmethod will be called from my flex application and display the data in a flex grid.&amp;nbsp;&lt;/p&gt;&lt;p&gt;After you finish building the flex application, you will realize that an html file is created which embeds the swf file. The nice thing about flex application is it can be hosted under IIS. So first create a virtual directory in IIS and map it to your flex application. Now you can access it for example like (http://localhost/Flex/Inbox.html). &lt;/p&gt;&lt;p&gt;In your .NET web application now you can create an iframe, set its source to the location of your flex application (Easy Right?) that&amp;#39;s all you need to implement this integration between these two technologies&lt;/p&gt;&lt;p&gt;Below is the HTML code &lt;/p&gt;&lt;p&gt;&amp;lt;iframe src=&amp;quot;http://localhost/Flex/Inbox.html&amp;quot; width=&amp;quot;50%&amp;quot; height=&amp;quot;50%&amp;quot;/&amp;gt;&lt;/p&gt;&lt;p&gt;Another way to do it, is to put the swf file generated by Flex inside your application folder and in your HTML code add an Object tag set its source to the switch file (swf).&lt;/p&gt;&lt;p&gt;HC&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=12116" width="1" height="1"&gt;</content><author><name>haissam</name><uri>http://dotnetslackers.com/Community/members/haissam.aspx</uri></author></entry></feed>