Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6772541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:33:41+00:00 2026-05-26T15:33:41+00:00

I get this error randomly, sometimes it shows and sometimes not! The Error: Now

  • 0

I get this error randomly, sometimes it shows and sometimes not!

The Error:

Now it disappeared :S! but it will appear within the next hours!
Simply, It states that the parametrized query need a parameter ‘@PorfilePic’ which was not supplied, although that it’s supplied and the website works locally and also works on the server. I don’t change the code, the provider doesn’t change any settings.

I was told that I exceed my memory limit for the AppPool which is 250 MB but I think it should it appear once I exceed and after the pool rests it should work normally. but this is was the case a week ago. now it just works randomly for hours and randomly shows this error! so I hope maybe someone got the same error and could help to figure it out.

Btw, this is a shared windows hosting account. and I spoke with my providers, Honestly I think they are good in everything (Seriosuly) but in everything other than finding this specific error! 😀

The Code:

.Aspx Page:

<li>
    Profile Picture:
    <asp:FileUpload ID="ProfilePic_Upld" runat="server" ViewStateMode="Enabled" /><br />
</li>

Code Behind File:

if (ProfilePic_Upld.HasFile)
{
    string fileType = ProfilePic_Upld.PostedFile.ContentType;

    if (fileType == "image/bmp" || fileType == "image/gif" || fileType == "image/jpeg" || fileType == "image/png")
    {
        if (ProfilePic_Upld.PostedFile.ContentLength <= 10485760)
        {
            string ppFileName = ProfilePic_Upld.PostedFile.FileName;
            string savedFileName = newCruise.Name + "_pp" + ppFileName.Substring(ppFileName.IndexOf('.'));
            string cruisePpUploadPath = Server.MapPath(ConfigurationManager.AppSettings["cruisesPpUploadPath"].ToString());
            ProfilePic_Upld.SaveAs(cruisePpUploadPath + savedFileName);
            newCruise.ProfilePic = savedFileName;
        }
    }
}
else
{
    newCruise.ProfilePic = "default.jpeg";
}

Web.config (ApplicationSettings Part):

<appSettings>
<add key="cruisesPpUploadPath" value="~\resouces\cruises\cruise_pp\" />
<add key="cruisesDpUploadPath" value="~\resouces\cruises\cruise_dp\" />
<add key="cruisesClUploadPath" value="~\resouces\cruises\cruise_cl\" />
<add key="cruiseItinerariesPpUploadPath" value="~\resouces\cruises\itineraries\iti_pp\" />
<add key="cruiseItinerariesMapsUploadPath" value="~\resouces\cruises\itineraries\iti_maps\" />
<add key="cruiseReviewDocumentsUploadPath" value="~\resouces\cruises\reviews\" />

</appSettings>

Cruise Class (newCruise)

public class Cruise
{
    public int ID
    { get; set; }

    public string Name
    { get; set; }

    public int CountryID
    { get; set; }

    public string ProfilePic
    { get; set; }

    public string Description
    { get; set; }

    public int OfficialRate
    { get; set; }

}

DAL Methode for creating new cruise

    public static int AddNewCruise(Cruise NewCruise)
    {
        string commandText = "INSERT INTO Cruises (Name, CountryID, ProfilePic, Description, OfficialRate) VALUES (@Name, @CountryID, @ProfilePic, @Description,  @OfficialRate); SELECT scope_identity();";
        int newCruiseId;

        Cruise newCruise = NewCruise;
        string name = newCruise.Name;
        int countryId = newCruise.CountryID;
        string profilePic = newCruise.ProfilePic;
        string desc = newCruise.Description;
        int officialRate = newCruise.OfficialRate;

        using (SqlConnection connection = new SqlConnection(ConnectionString))
        {
            using (SqlCommand command = new SqlCommand(commandText, connection))
            {
                command.Parameters.AddWithValue("@Name", name);
                command.Parameters.AddWithValue("@CountryID", countryId);
                command.Parameters.AddWithValue("@ProfilePic", profilePic);
                command.Parameters.AddWithValue("@Description", desc);
                command.Parameters.AddWithValue("@OfficialRate", officialRate);

                connection.Open();

                newCruiseId = Convert.ToInt32(command.ExecuteScalar());


                return newCruiseId;
            }
        }
    }

N.B I’m running out of my deadline, so if anyone think that this is a problem with the server I hope you could suggest some good windows shared hosting providers.

N.B (2) The pictures that I upload doesn’t exceed 1 MB!

N.B (3) Guys, please this is a very important note. The website is working without any errors right now, and however you’re right about handling the uploaded file (which btw I updated to include else blocks for the Size and File Type if conditions by providing an error message and then return;) but the actual problem is that I use the same code, same website, same server and iis settings. so same application, and I also update the same image but I get the error randomly. this can’t be about the file handling! I upload a jpg image of size 105 KB. one day it works, the other day it won’t! so however you’re totally right about handling the file and I already followed your advice as this is a defect in my system, but this is not the cause of the problem. I really wish it could be that simple!

Conclusion:

First of all the problem was that I’m testing when developing on my personal PC where I use Firefox, Then Me and the client follow up on the work from our business PCs which uses Internet Explorer. the problem was in not handling the two conditions for the size and the type, so I don’t accept the uploaded file but I still call the database methode, so this was the first step. then I just followed the advise and returned whenever any of the conditions are not met, so I upload the same picture to two different instances of my application (one opened from IE and another from FireFox). Firfox uploads fine but IE now display type error. I did a little research and turns out that IE receive jpg and png as progressive types (PJPEG and X-PNG) so by adding in my type condition image/jpeg and image/x-png everything works fine.

Thanks for your time, Much appreciated =). I hope this question helps, I don’t if this is a famous thing in IE but for me I think it’s weird and I believe that other people are looking into the same issue!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:33:41+00:00Added an answer on May 26, 2026 at 3:33 pm

    It states that the parametrized query need a parameter '@PorfilePic' which was not supplied1

    This to me, indicates that you are storing the name/path of the uploaded file to a database, and the value it is attempting to insert (at that time) is a null string.

    Edit

    Looking at the code, if the file type or file size conditions are not met, then it is possible that newCruise.ProfilePic will not be set, resulting in a possible null reference.

    (It’s hard to tell without the code for the newCruise class.)

    if (fileType == "image/bmp" || fileType == "image/gif" || fileType == "image/jpeg" || fileType == "image/png")
    {
        if (ProfilePic_Upld.PostedFile.ContentLength <= 10485760)
        {
    

    Edit

    Based on your DAL code. It is definitely possible for what I describe above to occur.

    If the file type does not match your conditions or the file size is too large, the code will cause the exception mentioned. (If, it calls the AddNewCruise method regardless of the out come of the conditions)

    I suggest performing some validation on the Cruise object before persisting it.

    At the very least you should not be invoking AddNewCruise method, if the file type and size conditions above have not been satisfied, without providing some default values (such as newCruise.ProfilePic = "default.jpeg";).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get this error on an update panel within a popupControlExtender which is within
I get this error: System.Reflection.TargetException: Object does not match target type. when trying to
This error comes up in our MVC app randomly. Sometimes doing the same exact
I get this error randomly when using Zend_Search_Lucene. Exception thrown without a stack frame
I randomly get this error, and I can't figure out a way to fix
I get this error: Can't locate Foo.pm in @INC Is there an easier way
I get this error when I do an svn update : Working copy XXXXXXXX
I get this error:- You have an error in your SQL syntax; check the
We get this error in Visual Studio 2005 and TFS very often. Can anyone
i get this error {Method 'System.DateTime ConvertTimeFromUtc(System.DateTime, System.TimeZoneInfo)' has no supported translation to SQL.}

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.