<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>HttpHandlers and HttpModules</title><link>http://forums.asp.net/27.aspx</link><description>Extending the ASP.NET Framework through HttpModules and HttpHandlers.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: HttpHandler or HttpModule for file upload, large files, progress indicator?</title><link>http://forums.asp.net/thread/2785351.aspx</link><pubDate>Thu, 04 Dec 2008 14:13:03 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2785351</guid><dc:creator>SSNASP</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2785351.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=2785351</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I need to upload large files like &amp;nbsp;&amp;gt; 1 gb .I am new to ASP.NET. I want to use HttpModule with Chunk method&amp;nbsp;. Any one please post the full source code or URL info.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I am expecting your replay.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Ram&lt;/p&gt;</description></item><item><title>Re: HttpHandler or HttpModule for file upload, large files, progress indicator?</title><link>http://forums.asp.net/thread/1852248.aspx</link><pubDate>Fri, 10 Aug 2007 16:00:35 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1852248</guid><dc:creator>DoriumDakre</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1852248.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1852248</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;On a funny side, i&amp;#39;ve got it working (teste with file up to 2gig) with the normal file upload component in 2.0 by setting a few thing before uploading the file.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;for infos about these Property:&lt;/p&gt;&lt;p&gt;http://msdn2.microsoft.com/en-us/library/e1f13641.aspx  &lt;br /&gt;&lt;/p&gt;&lt;p&gt;maxRequestLength=&amp;quot;2000&amp;quot; &lt;/p&gt;&lt;p&gt;executionTimeout=&amp;quot;90&amp;quot;&lt;br /&gt;&lt;br /&gt;shutdownTimeout=&amp;quot;90&amp;quot;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;requestLengthDiskThreshold=&amp;quot;256&amp;quot;&lt;/p&gt;&lt;p&gt;I simply modify them before uploading and change it back after.&amp;nbsp;&lt;/p&gt;&lt;p&gt; It sure not as nice as other solutions and offer no progress bar but just wanted to share the easy fix. &lt;/p&gt;&lt;p&gt;Was hella nice to read all this topic too. Thx to all who shared. &amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: HttpHandler or HttpModule for file upload, large files, progress indicator?</title><link>http://forums.asp.net/thread/1699757.aspx</link><pubDate>Tue, 08 May 2007 09:07:30 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1699757</guid><dc:creator>forward.mailer</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1699757.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1699757</wfw:commentRss><description>&lt;p&gt;I have a page there i want to upload a csv file, and the content will be put into database.&lt;/p&gt;&lt;p&gt;now if that file is 10-20 MB+, it takes lots of time, plus some time request timeout occurs. &lt;/p&gt;&lt;p&gt;how to address this problem ? &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: HttpHandler or HttpModule for file upload, large files, progress indicator?</title><link>http://forums.asp.net/thread/1694499.aspx</link><pubDate>Fri, 04 May 2007 06:48:21 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1694499</guid><dc:creator>joytony</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1694499.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1694499</wfw:commentRss><description>&lt;p&gt;Hi Guys,

&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br /&gt;Do you know any solution that can use FTP in ActiveX control &amp;amp; upload the file in ASP.NET?&lt;br /&gt; &lt;/p&gt;</description></item><item><title>Re: HttpHandler or HttpModule for file upload, large files, progress indicator?</title><link>http://forums.asp.net/thread/1413326.aspx</link><pubDate>Thu, 28 Sep 2006 21:00:26 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1413326</guid><dc:creator>darick_c</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1413326.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1413326</wfw:commentRss><description>&lt;p&gt;For those who can&amp;#39;t use this technique because their hosting service is less than full trust (Reflection is not allowed), I wrote a tutorial on how to use flash to upload multiple files to a HttpHandler. &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.codeproject.com/useritems/FlashUpload.asp"&gt;http://www.codeproject.com/useritems/FlashUpload.asp&lt;/a&gt;&lt;/p&gt;&lt;p&gt;It is pretty simple.&amp;nbsp; Something that TravisWhidden pointed out was that in the HttpPostedFile class definition &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.httppostedfile.aspx"&gt;http://msdn2.microsoft.com/en-us/library/system.web.httppostedfile.aspx&lt;/a&gt;&amp;nbsp;it says &amp;quot;By default, all requests, including form fields and uploaded files, larger than 256 KB are buffered to disk, rather than held in server memory.&amp;quot;&amp;nbsp; So the code basically just shows how to use the flash and asp.net together to accomplish a nice uploader interface. Hope this is useful. And thanks for all the great contributions.&lt;/p&gt;</description></item><item><title>Re: HttpHandler or HttpModule for file upload, large files, progress indicator?</title><link>http://forums.asp.net/thread/1342801.aspx</link><pubDate>Mon, 17 Jul 2006 02:31:05 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1342801</guid><dc:creator>TravisWhidden</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1342801.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1342801</wfw:commentRss><description>&lt;p&gt;Sorry it took so long for me to get this up.&amp;nbsp; I wrote up a project on codeproject.com&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.codeproject.com/useritems/UpldFileToDiskProgressBar.asp"&gt;http://www.codeproject.com/useritems/UpldFileToDiskProgressBar.asp&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I look forward to your input.&amp;nbsp; Enjoy everyone and thanks again for everyone help.&lt;/p&gt;</description></item><item><title>Re: HttpHandler or HttpModule for file upload, large files, progress indicator?</title><link>http://forums.asp.net/thread/1338742.aspx</link><pubDate>Wed, 12 Jul 2006 03:40:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1338742</guid><dc:creator>TravisWhidden</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1338742.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1338742</wfw:commentRss><description>&lt;p&gt;I don’t want to crack on anyone in this thread. It has been extremely good reading knowledge.&amp;nbsp; However, this last example, while it was nice is extremely slow. Why people like to convert byte arrays to strings and do comparisons I have no idea.&amp;nbsp; Not only does it take a crap load of CPU, it posts files are retarded slow speeds. There are other problems with the above example I do not care to comment on, but can cause file corruption.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p&gt;I rewrote this using much more efficient byte array searching, including the ability to look at the last buffer to see if patterns exist with the two byte array buffers combined.&amp;nbsp; It works REALLY nice and have wrote a progress indicator for it too.&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p&gt;I plan on writing a full article on it and referencing everyone that contributed to this.&amp;nbsp; If you would like my "FREE" software, I will email you a zip of it.&amp;nbsp; I’m not going to go and sell this just because I was able to get it to work.&amp;nbsp;&amp;nbsp; I’m still doing more testing on it, but I have been able to upload huge files with no errors at all on my production server&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p&gt;Email me at travis at lvfbody.com and I will get you what I have so far.&amp;nbsp; Please mention something in the subject about my “File Upload Module”. Oh, and I believe in code comments so other people can see what the heck I am doing.&lt;/p&gt;
&lt;p&gt;Like I said, I am not trying to bash on anyone, but many people on this forum and others just are doing things so inefficiently.&lt;span&gt;&amp;nbsp; &lt;/span&gt;If you can help improve my code, that would be great. I look forward to writing something up to put online.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class=MsoNormal&gt;Oh yea, I developed this all in .net 2.0. If you want to use it with 1.1, you will have to change some things in it.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Should be minor.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Thanks again to everyone how has contributed to this literally over the years!&lt;/p&gt;</description></item><item><title>Re: HttpHandler or HttpModule for file upload, large files, progress indicator?</title><link>http://forums.asp.net/thread/1320253.aspx</link><pubDate>Wed, 21 Jun 2006 04:46:15 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1320253</guid><dc:creator>Jon Ni</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1320253.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1320253</wfw:commentRss><description>&lt;p&gt;Hi MaduraiKaran and all .net friends,&lt;/p&gt;
&lt;p&gt;Here is my code for resolving the HTTP Head Filtering issue. I've test edit under VS2003 and just for your reference:&lt;/p&gt;
&lt;p&gt;Imports System&lt;br /&gt;Imports System.IO&lt;br /&gt;Imports System.Web&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Public Class UploadModule&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Implements IHttpModule&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Sub New()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyBase.New()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Sub Dispose() Implements System.Web.IHttpModule.Dispose&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Sub Init(ByVal context As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AddHandler context.BeginRequest, AddressOf BeginRequest&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub BeginRequest(ByVal source As Object, ByVal e As EventArgs)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Get new Upload Data Analysis&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim FAnalysisUploadData As New AnalysisUploadData&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Get Received Data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim HttpApp As HttpApplication = CType(source, HttpApplication)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim theHttpContext As HttpContext = HttpApp.Context&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If InStr(theHttpContext.Request.ContentType, "multipart/form-data") = 0 Then&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; Exit Sub&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Get the HttpWorkerRequest Object!!! &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim HttpWR As HttpWorkerRequest = CType(theHttpContext.GetType.GetProperty("WorkerRequest", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic).GetValue(theHttpContext, Nothing), HttpWorkerRequest)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If HttpWR.HasEntityBody Then&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;&amp;nbsp; Try&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Const DefaultBufferLength As Integer = 65536&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; Const DefaultBufferLength As Integer = 1024 * 2&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Buffer As Byte()&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; Dim Received As Integer = 0&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; Dim TotalReceived As Integer = 0&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; Dim ContentLength As Integer = CType(HttpWR.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentLength), Integer)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Buffer = HttpWR.GetPreloadedEntityBody()&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FAnalysisUploadData.AnalysisReceivedData(Buffer, Buffer.Length)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Received = Buffer.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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TotalReceived += Received&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not HttpWR.IsEntireEntityBodyIsPreloaded Then&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Read Data in DefaultBufferLength size&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; While (ContentLength - TotalReceived) &amp;gt;= DefaultBufferLength&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Buffer = New Byte(DefaultBufferLength) {}&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Received = HttpWR.ReadEntityBody(Buffer, DefaultBufferLength)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FAnalysisUploadData.AnalysisReceivedData(Buffer, Received)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TotalReceived += Received&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; End While&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Read the Remain Data&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; Buffer = New Byte(DefaultBufferLength) {}&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; Received = HttpWR.ReadEntityBody(Buffer, (ContentLength - TotalReceived))&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; FAnalysisUploadData.AnalysisReceivedData(Buffer, Received)&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; TotalReceived += Received&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; End If&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Finish AnalysisRecievedData&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; Buffer = New Byte(DefaultBufferLength) {}&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; FAnalysisUploadData.UploadSplitHeadSize = 0&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; FAnalysisUploadData.AnalysisReceivedData(Buffer, DefaultBufferLength + 1)&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;&amp;nbsp; Catch ex As Exception&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;&amp;nbsp; Finally&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; FAnalysisUploadData.CloseOpenFiles()&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; End Try&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;&amp;nbsp; theHttpContext.Application("Result") = FAnalysisUploadData.LogStr&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;&amp;nbsp; theHttpContext.Response.Redirect("uploadform.aspx")&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;End Class&lt;/p&gt;
&lt;p&gt;Public Class AnalysisUploadData&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public LogStr As String&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim AnalysisCount As Integer = 0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim AnalysisByte() As Byte&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim IsFileOperatingNow As Boolean = False&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim UploadSessionID As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim UploadSplitChar, UploadFileBeginChar, UploadEndChar As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public UploadSplitHeadSize As Integer = 300&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim FileName As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim FilePath As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim theFileStream As FileStream&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Sub AnalysisReceivedData(ByVal ReceivedByte() As Byte, ByVal ReceivedByteNumber As Integer)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim I As Integer&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AnalysisCount = AnalysisCount + 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If AnalysisCount = 1 Then&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; 'Get UploadSessionID&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 I = 29 To 29 + 12&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; UploadSessionID = UploadSessionID &amp;amp; Chr(ReceivedByte(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; Next&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;&amp;nbsp; 'Get UploadSplitChar&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; UploadSplitChar = "-----------------------------" &amp;amp; UploadSessionID&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;&amp;nbsp; 'Get UploadEndChar&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; UploadEndChar = "-----------------------------" &amp;amp; UploadSessionID &amp;amp; "--"&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Get the AnalysisByte and AnalysisStr&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim PreviousAnalysisByteLength As Integer = 0&lt;br /&gt;&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; PreviousAnalysisByteLength = AnalysisByte.Length&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As Exception&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReDim Preserve AnalysisByte(PreviousAnalysisByteLength + ReceivedByteNumber - 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For I = PreviousAnalysisByteLength To PreviousAnalysisByteLength + ReceivedByteNumber - 1&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; AnalysisByte(I) = ReceivedByte(I - PreviousAnalysisByteLength)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim AnalysisStr As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim StandAnalysisStrLength As Integer = AnalysisByte.Length&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For I = 0 To StandAnalysisStrLength - 1&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; AnalysisStr = AnalysisStr &amp;amp; Chr(AnalysisByte(I))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Read and analysis each UploadSplitChar one by one&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim IfNeedBreakDoWhile As Boolean&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim thePos As Integer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thePos = InStr(AnalysisStr, UploadSplitChar)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If thePos &amp;gt; 0 Then&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;&amp;nbsp; Do While (thePos &amp;gt; 0)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '----------------Finish Previous Operation-----------------&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; If IsFileOperatingNow Then&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; 'Write the remain byte and close 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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theFileStream.Write(AnalysisByte, 0, thePos - 1)&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; theFileStream.Flush()&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; theFileStream.Close()&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IsFileOperatingNow = 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;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&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; 'Ignore the data&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; End If&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Make sure the split str's start pos is not in AnalysisTail&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; If thePos &amp;gt;= Len(AnalysisStr) - UploadSplitHeadSize Then&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; ResizeToRightByte(AnalysisByte, Len(AnalysisStr) - thePos + 1)&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; Exit Do&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; End If&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '---------------Check whether the New Split is a 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; AnalysisStr = Right(AnalysisStr, Len(AnalysisStr) - thePos + 1)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If IsItAnUploadFile(AnalysisStr, FileName) Then&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; FilePath = "c:\upload\" &amp;amp; FileName&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Delete the current exist 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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If System.IO.File.Exists(FilePath) Then&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.IO.File.Delete(FilePath)&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; End If&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Create FileStream Object&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; theFileStream = New FileStream(FilePath, FileMode.CreateNew, FileAccess.Write, FileShare.Read)&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; IsFileOperatingNow = True&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Write 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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PutDataToFile(AnalysisStr, StandAnalysisStrLength, IfNeedBreakDoWhile)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Judge whether need to exit do, due cannot find the file end when writting the file data&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; If IfNeedBreakDoWhile Then&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit Do&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; End If&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; Else&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; 'Remove the upload split head&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; AnalysisStr = Right(AnalysisStr, Len(AnalysisStr) - 50)&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; End If&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thePos = InStr(AnalysisStr, UploadSplitChar)&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;&amp;nbsp; Loop&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&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; If IsFileOperatingNow Then&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; 'Write Analysis Byte and Leave 50 bytes&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theFileStream.Write(AnalysisByte, 0, StandAnalysisStrLength - 50)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ResizeToRightByte(AnalysisByte, 50)&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; IsFileOperatingNow = True&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; Else&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; 'Ignore Last Received Byte because it's not file data&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; End If&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Sub CloseOpenFiles()&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If IsFileOperatingNow Then&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; theFileStream.Flush()&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; theFileStream.Close()&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;&amp;nbsp; IsFileOperatingNow = False&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theFileStream = Nothing&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Function IsItAnUploadFile(ByVal HeadStr As String, ByRef FileName As String) As Boolean&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileName = ""&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Len(HeadStr) &amp;gt; 300 Then HeadStr = Left(HeadStr, 300)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim thePos As Integer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thePos = InStr(HeadStr, "filename=""")&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If thePos = 0 Or thePos &amp;gt; 110 Then&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 False&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HeadStr = Right(HeadStr, Len(HeadStr) - thePos - 9)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thePos = InStr(HeadStr, """")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileName = Left(HeadStr, thePos - 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thePos = InStrRev(FileName, "\")&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileName = Right(FileName, Len(FileName) - thePos)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return True&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub ResizeToRightByte(ByRef theByte() As Byte, ByVal RightSize As Integer)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim ByteLength As Integer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ByteLength = theByte.Length&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If RightSize &amp;gt;= ByteLength Then Return&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim I As Integer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For I = 0 To RightSize - 1&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; theByte(I) = theByte(ByteLength - RightSize + I)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReDim Preserve theByte(RightSize - 1)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub PutDataToFile(ByRef AnalysisStr As String, ByVal StandAnalysisStrLength As Integer, ByRef NeedBreakDoWhile As Boolean)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NeedBreakDoWhile = False&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim DataStartID, DataEndID As Integer&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim thePos As Integer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thePos = InStr(AnalysisStr, Chr(13) &amp;amp; Chr(10) &amp;amp; Chr(13) &amp;amp; Chr(10))&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If thePos &amp;gt; 0 Then&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;&amp;nbsp; AnalysisStr = Right(AnalysisStr, Len(AnalysisStr) - thePos - 3)&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; DataStartID = StandAnalysisStrLength - Len(AnalysisStr)&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;&amp;nbsp; thePos = InStr(AnalysisStr, UploadSplitChar)&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;&amp;nbsp; 'LogStr = LogStr &amp;amp; "AnalysisStr=" &amp;amp; AnalysisStr &amp;amp; vbCrLf &amp;amp; "&amp;lt;p&amp;gt;" &amp;amp; vbCrLf&lt;/p&gt;
&lt;p&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; If thePos &amp;gt; 0 Then&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; 'Found the File End&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; AnalysisStr = Right(AnalysisStr, Len(AnalysisStr) - thePos + 3)&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; DataEndID = StandAnalysisStrLength - Len(AnalysisStr) - 1&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theFileStream.Write(AnalysisByte, DataStartID, DataEndID - DataStartID + 1)&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; theFileStream.Flush()&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; theFileStream.Close()&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IsFileOperatingNow = 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;&amp;nbsp;&amp;nbsp;&amp;nbsp; NeedBreakDoWhile = 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; Else&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; 'Did not find the file end, leave 50 length for AnaysisByte and exit do&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; "-----------------------------7d6ab36c03d2" length is 41&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; DataEndID = StandAnalysisStrLength - 50 - 1&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theFileStream.Write(AnalysisByte, DataStartID, DataEndID - DataStartID + 1)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ResizeToRightByte(AnalysisByte, 50)&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; IsFileOperatingNow = True&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; NeedBreakDoWhile = True&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; End If&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;br /&gt;End Class&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: ReadEntityBody() returning 0 after timeout?  Answer below...</title><link>http://forums.asp.net/thread/1256287.aspx</link><pubDate>Thu, 13 Apr 2006 00:55:21 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1256287</guid><dc:creator>devnull</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1256287.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1256287</wfw:commentRss><description>i can get an instance of the HttpWorkerRequest fine when the app is running on Full trust, but when its running at High or Medium i get a security error.&lt;br /&gt;&lt;br /&gt;anyone figured out how to get it working with High/Medium trust?&lt;br /&gt;</description></item><item><title>Re: ReadEntityBody() returning 0 after timeout?  Answer below...</title><link>http://forums.asp.net/thread/1235852.aspx</link><pubDate>Thu, 23 Mar 2006 19:02:13 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1235852</guid><dc:creator>Michael Leibman</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1235852.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1235852</wfw:commentRss><description>&lt;p&gt;&lt;font face=Verdana size=2&gt;One more thing.&amp;nbsp; You also need to turn TRACING off in the web.config since it essentially reads all request fields itself.&lt;/font&gt;&lt;/p&gt;</description></item><item><title>Re: ReadEntityBody() returning 0 after timeout?  Answer below...</title><link>http://forums.asp.net/thread/1235815.aspx</link><pubDate>Thu, 23 Mar 2006 18:28:15 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1235815</guid><dc:creator>Michael Leibman</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1235815.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1235815</wfw:commentRss><description>NOTE:&amp;nbsp; This also applies to Request["..."] and Request.Params["..."] syntax.</description></item><item><title>ReadEntityBody() returning 0 after timeout?  Answer below...</title><link>http://forums.asp.net/thread/1235015.aspx</link><pubDate>Thu, 23 Mar 2006 06:46:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1235015</guid><dc:creator>Michael Leibman</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1235015.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1235015</wfw:commentRss><description>&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Obviously, by this point, there is a lot of information on the web about implementing this sort of solution, and we are actually using the same approach at my company, so I am not going to comment on that.&amp;nbsp; Suffice to say, this thread has proven to be very valuable.&lt;br /&gt;The only problem with the code provided in this thread is that it does not work in IIS6 since the worker process used there is a subclass of &lt;i&gt;ISAPIWorkerRequestInProc&lt;/i&gt;, so going directly to the base class gives you &lt;/font&gt;&lt;/font&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;&lt;i&gt;ISAPIWorkerRequestInProc &lt;/i&gt;and not &lt;i&gt;ISAPIWorkerRequest&lt;/i&gt;.&amp;nbsp; This can easily be fixed by walking up the inheritance tree until you get to &lt;i&gt;ISAPIWorkerRequest &lt;/i&gt;instead of blindly going to the base class.&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;&lt;br /&gt;&lt;br /&gt;One problem that I had in my implementation specifically, was &lt;i&gt;ReadEntityBody()&lt;/i&gt; returning 0 after a timeout under certain conditions.&amp;nbsp; I've spent quite a bit of time trying to find the solution in various search engines, but unfortunately left empty-handed.&amp;nbsp; It seems that a lot of people were having the same problem, but all of their posts either went unanswered or were answered with complete BS.&amp;nbsp; Two particular replies come to mind.&amp;nbsp; One is from an MVP who said "That's Internet for You..." and another from MS Support who said "Use Request.Files instead".&amp;nbsp; Very helpful indeed :)&amp;nbsp; I am sure that people who were having these problems eventually resolved them, but nobody bothered to post the answer.&amp;nbsp; And it would have saved me 3 hours...&amp;nbsp; Oh well.&amp;nbsp; Hopefully, I can clear things up a little, so that the next poor soul does not have to repeat it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The short version:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Make sure you are not referencing any FORM variables before you attempt to read the entity body.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The long version:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Simply put, this is a bug in the implementation and not in the .NET Framework / IIS.&amp;nbsp; The WorkerProcess is not meant to be accessed from &lt;i&gt;IHttpModule/HttpContext&lt;/i&gt;.&amp;nbsp; It is marked internal for a reason.&amp;nbsp; By using reflection go get access to an inaccessible property, we open up the Pandora's Box for problems like this.&amp;nbsp; Unfortunately, in ASP.Net 1.0/1.1 this seems to be the only option.&lt;br /&gt;&lt;br /&gt;This behavior occurs if you access FORM variables on the HttpRequest before attempting to call &lt;i&gt;ReadEntityBody()&lt;/i&gt;.&amp;nbsp; When the form is submitted using "&lt;u&gt;multipart/form-data&lt;/u&gt;", all FORM variables contained in the message body - the FORM field you are querying might well be defined AFTER the file contents in the HTTP post body.&amp;nbsp; So, in order to be able to read the FORM field value, it has to load the entire request body first.&amp;nbsp; The getter for &lt;i&gt;HttpRequest.Form&lt;/i&gt; initializes the field values collection by calling &lt;i&gt;FillInFormCollection()&lt;/i&gt; which in turn calls &lt;i&gt;GetMultipartContent()&lt;/i&gt;:&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;ol&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span&gt;private&lt;/span&gt; MultipartContentElement&lt;span&gt;[&lt;/span&gt;&lt;span&gt;]&lt;/span&gt; 
GetMultipartContent&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span&gt;{&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;this&lt;/span&gt;._multipartContentElements == &lt;span&gt;null&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &lt;span&gt;{&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;byte&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;]&lt;/span&gt; buffer1 = 
&lt;span&gt;this&lt;/span&gt;.&lt;span&gt;GetMultipartBoundary&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;buffer1 == &lt;span&gt;null&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;{&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;return&lt;/span&gt; &lt;span&gt;new&lt;/span&gt; MultipartContentElement&lt;span&gt;[&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;}&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;byte&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;]&lt;/span&gt; buffer2 = 
&lt;span&gt;this&lt;/span&gt;.&lt;span&gt;GetEntireRawContent&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;buffer2 == &lt;span&gt;null&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;{&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;return&lt;/span&gt; &lt;span&gt;new&lt;/span&gt; MultipartContentElement&lt;span&gt;[&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;}&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;this&lt;/span&gt;._multipartContentElements = 
HttpMultipartContentTemplateParser.&lt;span&gt;Parse&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;buffer2, 
buffer2.&lt;span&gt;Length&lt;/span&gt;, buffer1, &lt;span&gt;this&lt;/span&gt;.&lt;span&gt;ContentEncoding&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &lt;span&gt;}&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &lt;span&gt;return&lt;/span&gt; &lt;span&gt;this&lt;/span&gt;._multipartContentElements;&lt;/font&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;font face="Verdana" size="2"&gt;&lt;br /&gt;&lt;/font&gt;&lt;font face="Verdana" size="2"&gt;When this method is called for the first time, it initializes &lt;i&gt;_multipartContentElements&lt;/i&gt; by calling &lt;i&gt;GetEntireRawContent()&lt;/i&gt; which does exactly what we are doing in our file upload module - it reads the rest of HTTP post body using &lt;i&gt;ReadEntityBody()&lt;/i&gt;.&amp;nbsp; The difference is that since &lt;i&gt;GetEntireRawContent()&lt;/i&gt; does not reset WorkerProcess's &lt;i&gt;_contentAvailLength&lt;/i&gt;, _&lt;i&gt;contentTotalLength&lt;/i&gt;, _&lt;i&gt;preloadedContent &lt;/i&gt;and &lt;i&gt;_preloadedContentRead&lt;/i&gt; (nor should it), the next time we call &lt;i&gt;ReadEntityBody()&lt;/i&gt;, there's nothing left to read in the pipeline!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Hope this helps,&lt;br /&gt;Michael Leibman&lt;br /&gt;Lead Software Developer&lt;br /&gt;eProject Inc.&lt;br /&gt;&lt;a href="http://www.eproject.com"&gt;http://www.eproject.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;</description></item><item><title>GAME OVER</title><link>http://forums.asp.net/thread/1233373.aspx</link><pubDate>Tue, 21 Mar 2006 21:40:37 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1233373</guid><dc:creator>AbsoluteZero</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1233373.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1233373</wfw:commentRss><description>&lt;p&gt;While most of the thread starters have had their solution for awhile (years removed by now) I only stumbled upon this thread a week or so ago and, using this thread as reference, was able to correctly put together an HTTPModule that solves the problem proposed at the begining of the thread.&lt;/p&gt;
&lt;p&gt;I know that my previous post promised source code, however, there is about 500 lines of code altogether but I will elaborate on some areas that were not clear to me until I got straight down into coding.&amp;nbsp; (and there may be an email address at the end of this post where you can contact me at ;])&lt;/p&gt;
&lt;p&gt;First off, it doesn't matter which code base you use (&lt;strong&gt;CodeRage!&lt;/strong&gt; or &lt;strong&gt;Bjorn.B &lt;/strong&gt;posts on page 2) because you should be modifing that code anyway.&amp;nbsp; (Both code sets do what they are supposed but if you have read this entire thread the changes you should make are obvious, but ill explain.)&lt;/p&gt;
&lt;p&gt;The text file that is created in both the above examples are nice to see what a raw HTTP Request looks like because it defines the pattern you have to match to parse out the information but the truth of the matter is, after you have this system working those files become a moot point and you can remove the FileStream variable.&lt;/p&gt;
&lt;p&gt;There is where I spent a good amount of my time testing and working on things and, maybe someone can clarifiy something for me; after I created the text file I converted that text file back into a byte array but, for some reason, the file data was corrupted.&amp;nbsp; (Byte value 0 was replaced with byte value 32?) Before I realized this, my initial thought was to parse the text file, ya right.&amp;nbsp; Remember that asp.net sets aside 10 bytes of Data for a string variable + 2 * the string length; ok not so bad if you are working with extremely small files but when you go to parse that string, say using substring(), a copy of the original string is made so everytime you call substring another copy is made, you can see why you will run out of Memory quickly.&lt;/p&gt;
&lt;p&gt;After I realized that I was going to have to parse this information some other way, I needed to deal with my corrupted data and had read &lt;strong&gt;Turok-Han&lt;/strong&gt;&lt;a HREF="/user/Profile.aspx?UserID=545284"&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;/a&gt;'s post about System.Encoding.Default.GetBytes() as he was having the same problem I messed with this class, changing between UTF, ASCII, etc but to no avail, not only was my data corrupt but my byte array length was ALWAYS shorter then what my image length was. (In one case it was larger but significantly larger)&amp;nbsp; &lt;/p&gt;
&lt;p&gt;By this point I was begining to get frustrated and went through and re-read this thread and then, again, it was &lt;strong&gt;Bjorn.B&lt;/strong&gt; that gave me a push in the right direction when he listed the classes that he had created to process his files; he process's his files a byte at a time, but this means you have to parse the entire request a byte at a time because you have no idea where the fields start and end.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;My solution to this was to combine the byte array that held the preloaded body data and the body data into one byte array (completely bypassing a stream to the text file, since my data was getting corrupted when it was converted&amp;nbsp;from bytes to text and then back to bytes i had no use for that text file)&amp;nbsp;and then, myself, created a "DataParser" class that had one method: ParseData that took a byte as an argument.&lt;/p&gt;
&lt;p&gt;Up until the previous 3 paragraphs, any person having a remote knowledge of .NET could have moved around CodeRage!'s class (all you had to do was compile and go) but it was dishearting for me to read comments of people spamming this board asking how to Parse the headers.&amp;nbsp; I am all about sharing knowledge and helping someone out but there is a HUGE difference between that and simply having someone else do your work for you.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;What im trying to say is, attempt to come up with your own solution before you come asking for code, I took the code and subtle direction of this board and was able to come up with a solution, I suggest you do the same or all you will ever be is a second rate programmer who runs to Forums when they have a trivial problem. (I will admit i posted 2 threads wondering about why my data was getting corrupted (AFTER i had done everything I could think of), but I don't think that is a trivial problem)&lt;/p&gt;
&lt;p&gt;So the piece of the puzzle that has been missing, the DataParser.&lt;/p&gt;
&lt;p&gt;My solution to this was to work with the byte array directly (this is a point where you should my a char array and convert your entire httpRequest to a character array and write both the byte array and character array to a text file, that will show you which byte values are associated with what characters).&amp;nbsp; So what does any good parser do?&amp;nbsp; It removes the data you need from a file and gets rid of the rest, but to do this you need to find a pattern in the file you are parsing.&amp;nbsp; In our case we have an HTTP Request so, if you have run CodeRage! or Bjorn's code, open up one of those text files.&lt;/p&gt;
&lt;p&gt;The first line will always be a series of '------------' (30 to be exact) followed by a series of Alpha and Numeric characters, this is your leading boundary the. (hyphen (-) has a byte value of 45 fyi) The end of each line is denoted by byte value 13 and then 10 the nearest i can guess is this is a Carriage Return and a line feed.&amp;nbsp; So that is how you determine the end of your lines and the begning and end of your boundaries.&lt;/p&gt;
&lt;p&gt;Each subsequent line (except your actual data)&amp;nbsp;after the Boundary will begin with a C (byte value 67)&amp;nbsp; e.g.: Content-Disposition or Content-Type.&amp;nbsp; The latter line will only exist if the data you are working with is an uploaded file. Each value on the Content-Disposition line is delimited by a (;)&amp;nbsp; (byte value 59)&amp;nbsp; this is how you determine what you are working with (file name, control id, content dispo) and then you parse your data from there.&lt;/p&gt;
&lt;p&gt;Content-Type does not have a (;) but there is a space (byte value 32)&amp;nbsp;between content-type and the file type so there is your delimiter to look for.&lt;/p&gt;
&lt;p&gt;Regardless if you are working with a file or with text from a text box, there is always a line break between the data and the data information (13, 10) this is how you can tell when you start working with your data.&lt;/p&gt;
&lt;p&gt;This is the tricky part, all of the delimiting values i have mentioned thus far (45,13,10) all will exist inside of your data so what I did was I created a loop that went through the entire data field and incrimented a integer for each pass if my loop didnt find 10 '-' together.&amp;nbsp; If the loop found 10 '-' I exited the loop and the integer that I had been incrimenting is my file length (in bytes) so I created another byte array and set its length to that of my counting integer and went through the loop one more time, this time adding bytes to the array i had just created.&amp;nbsp; And guess what?&amp;nbsp; You now have the file and its size!&amp;nbsp; At this point you could write the array to disk and save the file with appropriate extension and your done...that doesnt fit my needs as I am saving my files directly to a database.&amp;nbsp; Being that I already have the file stored in a byte array i created yet another class called DataAccess and it to contained only 1 method, proccess files.&amp;nbsp; It excepts 3 arguments, file type (string), length(integer), and data (byte).&lt;/p&gt;
&lt;p&gt;From here it is as simple as connecting to a database and passing the information in.&amp;nbsp; Im not going to go into how to retrieve the data or what you need for that, you need to figure SOMETHING out ;]&lt;/p&gt;
&lt;p&gt;If you have read this post in its entireity, I have all but done the work for you.&amp;nbsp; I have told you how to parse the data, what your delimiters are, and so on; the only thing I haven't done is code for you.&amp;nbsp; As I said, I think you should try to solve this problem using all the reference in this thread, you are a programmer and that is what you do: Solve problems.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;If you are unable to solve the problem or if you are just lazy, you can contact me at &lt;a href="mailto:abs0lutezeerow@gmail.com"&gt;abs0lutezeerow@gmail.com&lt;/a&gt; and I will share my source code with you, and that is ALL I will do. I will not support it, I will not answer any questions you have about it, I will let you look at it and get an idea how it works.&amp;nbsp; It is NOT a complete solution, there is no upload progress bar there is no option to save to disk, you must adjust it accordingly.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;My hats off to the thread starters and all of the commenters, but I think this thread is offically closed. =]&lt;/p&gt;
&lt;p&gt;-Regards,&lt;/p&gt;
&lt;p&gt;Doug&lt;/p&gt;</description></item><item><title>Re: Somebody must know the answer, please help: HttpHandler or HttpModule for file upload, large files, progress indicator?</title><link>http://forums.asp.net/thread/1225422.aspx</link><pubDate>Tue, 14 Mar 2006 02:26:12 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1225422</guid><dc:creator>AbsoluteZero</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1225422.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1225422</wfw:commentRss><description>&lt;p&gt;Well this have been an exhausting thread and I would like to extended my gratitude to CodeRage, ups, and everyone else that had intellectual feedback on this topic.&amp;nbsp; No doubt this thread will be visited countless more times before it is closed and locked by the Admins so for anyone that comes to this thread and decides to post questions let me recap the entire thread so that you dont waste your keystrokes.&lt;/p&gt;
&lt;p&gt;-It is to your advantage to understand both C# and VB.Net when reading this thread as examples are mixed between both languages&lt;/p&gt;
&lt;p&gt;-Both CodeRages and ups's code work, however, I found that if I ran the input fields as server controls I was able to get a more worthwhile HTTP Request.&amp;nbsp; (ContentType, filename, etc)&lt;/p&gt;
&lt;p&gt;-Noone on here has provided a "canned solution" for this application, however, there is enough information within this thread to assemble an httpmodule that will circumvent that Memory issue of the aspnet_wp.exe &lt;/p&gt;
&lt;p&gt;-Before you have a useable file, you must convert the encoded file into a useable file. (This requires parsing the text file that is created.)&lt;/p&gt;
&lt;p&gt;-An answer to UPS's one question, Microsoft didn't reply to this thread because they didnt have to; they had a team of developers figuring out a work around to their code...for free.&amp;nbsp; You have essentially done them a favor.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;-Lastly, had it not been for this thread I would still be sitting here staring at my C++ books cotemplating whether or not I really wanted to write an ISAPI Filter for IIS so for that I am greatly thankful and as such I will post my COMPLETE SOURCE CODE here within the next couple of days, however unsupported, as I do not have enough time throughout the day to answer questions.&amp;nbsp; (Some of the features that I am implementing obviously not everyone will use, but you will get the general idea)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;-Doug&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Somebody must know the answer, please help: HttpHandler or HttpModule for file upload, large files, progress indicator?</title><link>http://forums.asp.net/thread/1102985.aspx</link><pubDate>Fri, 04 Nov 2005 18:25:48 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1102985</guid><dc:creator>jasonchewy</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1102985.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=27&amp;PostID=1102985</wfw:commentRss><description>&lt;pre&gt;I've just recently stumbled upon the asp.net file upload forum.&lt;br&gt;&lt;br&gt;I'm having problem where the readentitybody returns 0.&lt;br&gt;&lt;br&gt;Not really sure if the problem was solved on the forum.&lt;br&gt;&lt;br&gt;My readentitybody does work...until it gets to the end of a file, where the last "chunk" of the file doesn't get to the server.  it just returns 0 for&lt;br&gt;readentitybody, but never "hangs".&lt;br&gt;&lt;br&gt;If anyone has any tips, please let me know.&lt;br&gt;Thank You.&lt;br&gt;&lt;/pre&gt;</description></item></channel></rss>