Description: I am a rookie, the blog level is limited, only for the learning process of memo notes
1. Information:
—————————————————————————————————————————————————————————————————
2. Handling:
After adding the code structure to
Here to see the upload1.ashx file, the default is added, there will be a Upload1.ashx.cs file, which should cause a page error, we need to modify the Upload.ashx page, but at this point, only open
Upload1.ashx.cs file. The solution is to first copy the contents of the Upload1.ashx.cs and then manually delete the Upload1.ashx.cs file so that the file structure looks like upload0.ashx.
The directory structure that was deleted is
Point to open the Upload1.ashx file with only one line of code
<%@ webhandler language="C #" codebehind="Upload1.ashx.cs" Class="is.upload1" %>
Paste the code that you just copied in the Upload1.ashx.cs file into the Upload1.ashx file, as follows
<%@ WebHandler language="C #"Codebehind="Upload1.ashx.cs"class="IS.Web.Upload1"%>usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingsystem.web;namespaceis.web{/// <summary> ///Summary description of Handler1/// </summary> Public classHandler1:ihttphandler { Public voidProcessRequest (HttpContext context) {context. Response.ContentType="Text/plain"; Context. Response.Write ("Hello World"); } Public BOOLisreusable {Get { return false; } } }}
This time, still can not run normally, need to do is to delete codebehind= "Upload1.ashx.cs" and modify class= "IS.Web.Upload1" for class= "Upload1"
Run again and the page will work.
C # Web project error handling after adding *.ashx file