Click here to Skip to main content
16,019,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I'm taking video's url with FileUpload control in asp .net . And then I add this url to database. But when I'm doing this operation, operation takes too much time and becomes fail without any error message. I'm doing same operation with same c# code and same database table with same field for images, it's working very well. I guess problem comes from IIS but I don't know how to solve it. Is there any idea or solution?

I use following code in web.config file:
<httpRuntime targetFramework="4.5" maxRequestLength="1048576" executionTimeout="3600"/>


Thanks.
Posted

I solved the problem with this code:

XML
<security>
    <requestFiltering>
        <requestLimits maxAllowedContentLength="1073741824" />
    </requestFiltering>
</security>


maxAllowedContentLength=&quot;1073741824
this is refer to 1GB file size.
 
Share this answer
 
SQL
Hi,

just create a folder named upload in inetpub->wwwroot. save the file in that folder when you upload a file.
 
Share this answer
 
Comments
bmyusuf 14-Oct-12 5:53am    
My process in .aspx page side is: Selecting a video file with FileUpload control and then I click the Add button. The Add button takes video url to add this url to database. But when I click the Add button nothing happen and Add button codes not executed (I debugged the code). Under the web page info shows "Uploading(0%)..." Then time is up, and browser give web page not found warning.
did you checked the enableviewstate option in @page is set to true or false if it is true then make it false.
 
Share this answer
 
Comments
bmyusuf 14-Oct-12 7:09am    
I did your solution then I take an HTTP Error 404.13 error message. I solved the error which explain in this link: http://support.microsoft.com/kb/942074. After I solved the error then I returned the same problem. So problem didn't solve.
C#
protected void btnUpload_Click(object sender, EventArgs e)
       {
           HttpPostedFile file = File1.PostedFile;
           int intFileSize;
           filepath = @"Upload\";
           filetype = "";
           intupload = 0;

           if (file.FileName != "")
           {
               filename = GetFileName(file);

              intFileSize = Convert.ToInt32(file.ContentLength);
              if (intFileSize < 500000)
              {
                  if (file.ContentType.IndexOf("text/plain") >= 0)
                  {
                      file.SaveAs(Server.MapPath(@"\Upload\" + filename));
                      filepath = filepath + filename;
                      filetype = @"text/plain";
                      lblMsge.Text = filename + " File uploaded";
                      intupload = 1;
                      //UsrCallog ucal = new UsrCallog();
                      //ucal.insupload(
                  }


********************************

C#
private string GetFileName(HttpPostedFile file)
      {
          int i = 0, j = 0;
          string strAttCnt;
          string filename;

          filename = file.FileName;
          do
          {
              i = filename.IndexOf(@"\", j + 1);
              if (i >= 0) j = i;
          } while (i >= 0);
          filename = filename.Substring(j + 1, filename.Length - j - 1);

          conn = (string)ConfigurationSettings.AppSettings["cnStr"];
          using (cn = new SqlConnection(conn))
          {
              using (cmd = new SqlCommand("select count(*) from tblusrsol where attach =1", cn))
              {
                  cmd.CommandType = CommandType.Text;
                  cn.Open();
                  strAttCnt = cmd.ExecuteScalar().ToString();
                  cn.Close();
              }
          }

          return strAttCnt + filename;

      }


******************************************

after uploading i am saving the path on the label and after inserting it into database.
 
Share this answer
 
v3
Comments
bmyusuf 14-Oct-12 8:36am    
When I click the Add button process not entered the btnUpload_Click() method.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900