Solved

Trouble understanding the following error.

Posted on 2004-08-24
6
332 Views
Last Modified: 2008-01-09
Hi

I'm trying to use SoftArtisans.FileUp to upload a text file to the server.  I've used similar code for ASP, but am getting the following error using ASP.NET.  I'm new to this and do not understand the error.  Can someone shed some light?  

The source error points to this line of code...

Line 22: objUpload.Form("file").Save()

The error I'm getting is

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The server threw an exception.


Stack Trace:

[COMException (0x80010105): The server threw an exception.]
   Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack) +895
   ASP.process_aspx.Local_Page_Load() in C:\Inetpub\wwwroot\test.trends.fusionmedia.com\process.aspx:22
   ASP.process_aspx.Page_Load() in C:\Inetpub\wwwroot\test.trends.fusionmedia.com\global\scripts\server\common.vbs:14
   System.Web.Util.ArglessEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +10
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731

 

0
Comment
Question by:peerlesslv
  • 2
  • 2
  • 2
6 Comments
 
LVL 8

Expert Comment

by:trevorhartman
ID: 11884498
put a try/catch block around it and catch the exception that is being thrown.

Try
   objUpload.Form("file").Save()
Catch e As Exception
   Response.Write(e.ToString())
End Try
0
 
LVL 8

Expert Comment

by:trevorhartman
ID: 11884508
this will help you determine what the problem is.  if you need more help just post the results
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11884562
why not just use regular asp.net upload?

Regards,

Aeros
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:peerlesslv
ID: 11884671
Interesting point AerosSaga.  I read a little about asp.net upload and just might have to give that a try.

I've spent a little time on this current problem and feel like I just need to get to the bottom of it because its driving me nuts.    trevorhartman, thanks for the try/catch block.  here's what I got:

System.Runtime.InteropServices.COMException (0x80010105): The server threw an exception. at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack) at ASP.process_aspx.Local_Page_Load() in C:\Inetpub\wwwroot\test.trends.fusionmedia.com\process.aspx:line 24

Any sense?
0
 
LVL 17

Accepted Solution

by:
AerosSaga earned 250 total points
ID: 11884876
just drag the ASP.NET file browser control onto the page and modify this Sub to do what you need it to, save yourself a lot of trouble. I denoted the file saving processes with *****'s

 Private Sub AddProduct_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddProduct.Click
        If Not Page.IsPostBack Then Return

        ProductNameValidator.Enabled = True
        Tier1Validator.Enabled = True
        QueryValidator.Enabled = False
        Validate()

        If Not IsValid Then Return

        Dim cnn As New OleDb.OleDbConnection(ConfigurationSettings.AppSettings("SiteDB"))
        Dim cmd As New OleDb.OleDbCommand
        Dim IncomingFile As IO.FileInfo****
        Dim PriceValue As String
   

        If ImageSrc.PostedFile.ContentLength <> 0 Then
            IncomingFile = New IO.FileInfo(Request.Files(0).FileName)***
            IncomingFile = New IO.FileInfo(Server.MapPath("~/Pictures/Products/") & IncomingFile.Name)****
            Request.Files(0).SaveAs(IncomingFile.FullName)*******
         
        End If


        If Price.Text = "" Then
            PriceValue = "0"
        Else
            PriceValue = Price.Text
        End If

        cmd.CommandType = CommandType.Text
        cmd.CommandText = "INSERT INTO Products (Tier1ID, Tier2ID, Tier3ID, Name, " & _
            "Description, ImageSrc, Price, Weight, Size1, Size2, Size3, Size4, Size5, Size6, Size7, Size8, Size9, Size10) VALUES (" & Tier1.SelectedValue & ", " & _
            Tier2.SelectedValue & ", " & Tier3.SelectedValue & ", '" & ProductName.Text & _
            "', '" & Description.Text & "', '" & ImageSource & "', '" & PriceValue & "', " & Me.txtWeight.Text & _
            ", '" & Me.txtSize1.Text & "', '" & Me.txtSize2.Text & "', '" & Me.txtSize3.Text & "', '" & Me.txtSize4.Text & _
            "', '" & Me.txtSize5.Text & "', '" & Me.txtSize6.Text & "', '" & Me.txtSize7.Text & _
            "', '" & Me.txtSize8.Text & "', '" & Me.txtSize9.Text & "', '" & Me.txtSize10.Text & "')"
        cmd.Connection = cnn
        cnn.Open()
        cmd.ExecuteNonQuery()
        cnn.Close()
        cmd.Dispose()
        cnn.Dispose()
        LoadProductData()
    End Sub
0
 

Author Comment

by:peerlesslv
ID: 11885007
Thanks AerosSaga.  

Much better.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question