locked
Parameter is not valid error RRS feed

  • Question

  • User1964269700 posted

    I have an application that runs fine on my local development machine but throws an error on the production server. Both running ASP.NET 2.0. The error is:

     "System.ArgumentException: Parameter is not valid"

    The error is thrown on the second line below (there is code between those two lines to be sure that txtLogoURL.postedfile is not empty before trying to create the new bitmap):

    Dim strFile As String = txtLogoURL.PostedFile.FileName.ToString

    Dim objBitmap As Bitmap = New Bitmap(strFile)

    Can anyone help me figure out what is happening here?

    Thanks!

    Wednesday, January 3, 2007 10:00 AM

Answers

  • User-1372641848 posted

    Your code to load image should look some what like following. Your are loading image from filename which works on local system because image is available locally but won't work on production server. I missed that line while post my first answer.

     
    Bitmap uploadedimage = new Bitmap(ImageUpload.PostedFile.InputStream);
    
     
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 4, 2007 1:45 PM

All replies

  • User-1372641848 posted

    Make sure you have encType = multipart/form-data

    <FORM encType="multipart/form-data" runat="server">

    Wednesday, January 3, 2007 1:59 PM
  • User1964269700 posted
    Thanks, Jigar. I tried that but still has error at production server. 
    Wednesday, January 3, 2007 3:57 PM
  • User-1372641848 posted

    Your code to load image should look some what like following. Your are loading image from filename which works on local system because image is available locally but won't work on production server. I missed that line while post my first answer.

     
    Bitmap uploadedimage = new Bitmap(ImageUpload.PostedFile.InputStream);
    
     
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 4, 2007 1:45 PM
  • User1964269700 posted

    Many thanks, Jigar, that seems to have solved my problem! You are a star!

     Dave

    Friday, January 5, 2007 12:14 AM
  • User-1372641848 posted

    Many thanks, Jigar, that seems to have solved my problem! You are a star! 

    No Problem  please mark it as resolved and mark the post that solved your problem as answer.

    Saturday, January 6, 2007 4:19 PM