BBSWeb/Services/Bbs/ReplyHandler.ashx
(开头部分) 18KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<%@ WebHandler Language="C#" Class="ReplyHandler" %>
using System;
using System.Web;
using System.Web.SessionState;
using System.Data;
using BBS.Model;
using BBS.BLL;
using WebApp;
using System.Collections.Generic;
using BaseConfig;
public class ReplyHandler : IHttpHandler, IRequiresSessionState
{
string res = "";
public void ProcessRequest(HttpContext context)
{
if (HttpContext.Current.Session[SessionKey.USER] == null)
{
context.Response.Write("{\"status\" : \"success\",\"msg\": \"TimeOut\"}");
return;
}
context.Response.Clear();
context.Response.ContentType = "text/html";//这里一定要html
HttpFileCollection postedFile = context.Request.Files;
string _NewFileName = "";
string _sExtension = "";
string _UpLoadPath = "";
if (postedFile != null && postedFile.Count > 0)
{
string ZW = "";
try
{
string _SavePath = "";
string _tempPath = "";
_tempPath = System.Web.HttpContext.Current.Server.MapPath("~/FileUpLoad/Bbs");
_SavePath = _tempPath;
string filename = System.IO.Path.GetFileName(postedFile[0].FileName);
ZW = filename;
ZW = "{" + ZW + "}";
if (filename != "")
{
_sExtension = filename.Substring(filename.LastIndexOf('.')); //filename.Substring(filename.LastIndexOf('.'));
if (System.IO.Directory.Exists(_SavePath))
System.IO.Directory.CreateDirectory(_SavePath);
_NewFileName = filename.Substring(0, filename.IndexOf("."));
//新文件名
_NewFileName = System.DateTime.Now.ToString("yyyyMMddhhmmss") + (new Random().Next(20));
postedFile[0].SaveAs(_SavePath + @"\" + _NewFileName + _sExtension);
res = "{\"status\" : \"success\",\"msg\": \"upLoadSuccess\"}";
_UpLoadPath = "FileUpLoad/Bbs/" + _NewFileName + _sExtension;
}
}
catch (Exception)
{
context.Response.Write("{\"status\" : \"error\",\"msg\": \"upLoadFail\"}");
}
}
else
res = "{\"status\" : \"success\",\"msg\": \"submitSuccess\"}";
后面还有 319 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。