salaavoisuani
New Member
I have a VB.Net project in visual studio 2010 intended to let a user upload a video and then stick it in a DB. The file is called "Media/Test.aspx.vb".When I tried to run the code to debug, tons of errors were generated for a file called App_Web_nkhy2w0y.0.vbI couldn't locate this file anywhere, and I certainly didn't write it, so I double clicked on the error and it opened a file with about 350 lines of (apparently) auto-generated code, and I have no clue what I did to cause it to do this. Nor do I have any idea how to fix it.I'll admit I'm new to VB.Net, but I've never seen anything like this online so I'm in the dark.My original code is below for the code-behind file that handles nothing more than a fileupload control, button, and label in the actual page.\[code\]Imports System.IOImports System.Data.SqlClientImports System.DataPartial Class Media_TestInherits System.Web.UI.UserControlProtected Sub TryMe_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TryMe.Click Dim connection As SqlConnection 'check the file Dim buffer As Byte() If testFile.HasFile AndAlso testFile.PostedFile IsNot Nothing AndAlso testFile.PostedFile.FileName <> "" Then Dim file As HttpPostedFile = testFile.PostedFile 'retrieve the HttpPostedFile object buffer = New Byte(file.ContentLength - 1) {} Dim bytesReaded As Integer = file.InputStream.Read(buffer, 0, testFile.PostedFile.ContentLength) 'the HttpPostedFile has InputStream porperty (using System.IO 'which can read the stream to the buffer object, 'the first parameter is the array of bytes to store in, 'the second parameter is the zero index (of specific byte) 'where to start storing in the buffer, 'the third parameter is the number of bytes 'you want to read (do u care about this?) If bytesReaded > 0 Then Try Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString connection = New SqlConnection(connectionString) Dim cmd As New SqlCommand("INSERT INTO Videos (Video, Video_Name, Video_Size)" & " VALUES (@video, @videoName, @videoSize)", connection) cmd.Parameters.Add("@video", SqlDbType.VarBinary, buffer.Length).Value = http://stackoverflow.com/questions/15627553/buffer cmd.Parameters.Add("@videoName", SqlDbType.VarChar).Value = http://stackoverflow.com/questions/15627553/testFile.FileName cmd.Parameters.Add("@videoSize", SqlDbType.BigInt).Value = http://stackoverflow.com/questions/15627553/file.ContentLength Using connection connection.Open() Dim i As Integer = cmd.ExecuteNonQuery() Label1.Text ="uploaded, " & i.ToString() & " rows affected" End Using Catch ex As Exception Label1.Text = ex.Message.ToString() End Try End If Else Label1.Text = "Choose a valid video file" End IfEnd SubEnd Class\[/code\]And the top of the generated page is:\[code\]#ExternalChecksum("C:\Users\handcm\Documents\Visual Studio 2010\WebSites\APPS\Media\Test.aspx","{406ea660-64cf-4c82-b6f0-42d48172a799}","F31F20662F14B4894B6FBF58215628CB")'------------------------------------------------------------------------------' <auto-generated>' This code was generated by a tool.' Runtime Version:4.0.30319.296'' Changes to this file may cause incorrect behavior and will be lost if' the code is regenerated.' </auto-generated>'------------------------------------------------------------------------------\[/code\]I can post the entire file if need be, but could someone shine some light on what's going on here? I have no clue how to debug a file I didn't write or have never seen.Edit: Some of the error messages I am getting:
- Error 4 'GetWrappedFileDependencies' is not a member of 'ASP.media_test_aspx'. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\apps\f1b28c0f\bab8f810\App_Web_nkhy2w0y.0.vb 103
- Error 2 Class 'media_test_aspx' must implement 'ReadOnly Property IsReusable As Boolean' for interface 'System.Web.IHttpHandler'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\apps\f1b28c0f\bab8f810\App_Web_nkhy2w0y.0.vb 84
- Error 10 'ProcessRequest' is not a member of 'Media_Test'. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\apps\f1b28c0f\bab8f810\App_Web_nkhy2w0y.0.vb 342
- Error 1 'InitializeCulture' is not a member of 'ASP.media_test_aspx'. C:\Users\handcm\Documents\Visual Studio 2010\WebSites\APPS\Media\Test.aspx 1
I don't even know what the last one is referring to, as there is definitely not an "Initialize Culture" on the page.