getting error “Unknown Server error” while using a

2019-08-03 23:57发布

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
 }

2条回答
兄弟一词,经得起流年.
2楼-- · 2019-08-04 00:25

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

查看更多
一纸荒年 Trace。
3楼-- · 2019-08-04 00:35

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.

查看更多
登录 后发表回答