getting error “Unknown Server error” while using asyncfileupload in asp.net using c#?

一个人想着一个人 提交于 2019-12-24 19:13:54

问题


i am using asyncfileupload control to upload a .csv file an read it and store the data in database here is what i am doing :

<asp:AsyncFileUpload ID="venfileupld" runat="server" OnUploadedComplete="ProcessUpload" /> 

and here's the code:

protected void ProcessUpload(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{


    string name = System.IO.Path.GetFileName(e.FileName);
    string dir = Server.MapPath("upload_excel/");
    string path = Path.Combine(dir, name);
    venfileupld.SaveAs(path);
    writetodb(path);
    fetch4();

}

now everything is working fine in my localhost ... but when i uploaded this in a hosted server then i am getting an error when i am uploading a file .. the error is :

"Unknown Server Error"

what should i do ... i am using updatepanel also ... but i am not sure that will cause this ..

UPDATE:-

so as i got the 1st ans yes its a codebehind issue ... here what i am doing now :

<%@ Page Title="" Language="C#" MasterPageFile="~/MainMaster.master" AutoEventWireup="true"
CodeFile="Admin1.aspx.cs" Inherits="admin1" %>

should i try :

CodeBehind:"Admin.aspx.cs" 

then what should it Inherits ??

any help will be real helpfull

More Update

my .cs code starts like this :

  public partial class Admin1 : System.Web.UI.Page
{
     //all the codes
 }

回答1:


This problem you facing because of code-behind file is not found. check whether you are missing any code-behind files




回答2:


The problem is due to the fact of the server file not being shared to IIS. Right click on the folder you are trying to save the file to, navigate to security settings and add/allow ILS/USERS to modify the folder. This will solve your problem.



来源:https://stackoverflow.com/questions/13467349/getting-error-unknown-server-error-while-using-asyncfileupload-in-asp-net-usin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!