简体   繁体   中英

Can't get asp.net upload file example to work on IIS local network

I'm trying to upload files to my computer from another device connected to the same network. I already can view and download files from my computer on my smartphone, but I still don't know how can I upload files from my smartphone to my computer.
I'm using IIS on windows 10 on my computer to host files over private ip (so it works on the same network)
I have found example to upload files on https://docs.microsoft.com/en-us/troubleshoot/aspnet/upload-file-to-web-site , but when I try to implement it, it gives me error, that it can't load type 'upload.WebForm1' . I have deleted all the code except using directives, spacename and class. Here is the code:

WebForm1.aspx

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
   Inherits="upload.WebForm1" %>

When I include the rest stackoverflow says red: Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon. and not let me post question.
Rest of .aspx document is copied and not changed from complete code listing from the link above.

WebForm1.aspx.cs

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
namespace upload {
public class WebForm1 : System.Web.UI.Page
{

}
}

Any ideas what's wrong?

Can you try changing Codebehind to CodeFile

<%@ Page language="c#" CodeFile="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebForm1" %>

Usually follows for Website

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM