BBSWeb/Services/Bbs/S_VerifyH.ashx

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<%@ WebHandler Language="C#" Class="S_VerifyH" %>

using System;
using System.Web;
using System.Data;
using WebApp;
using System.Web.SessionState;
using BaseConfig;

public class S_VerifyH : IHttpHandler, IRequiresSessionState
{
    public void ProcessRequest(HttpContext context)
    {
        if (HttpContext.Current.Session[SessionKey.USER] == null)
        {
            context.Response.Write("{\"status\" : \"success\",\"msg\": \"登陆超时!\"}");
            return;
        }
        context.Response.Clear();
        context.Response.ContentType = "text/html";//这里一定要html
        HttpFileCollection postedFile = context.Request.Files;
        string sNewFileName = "";
        string sExtension = "";
        string uploadpath = "";
        string res = "";
        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);
                if (filename != "")
                {
                    ZW = filename;
                    ZW = "{" + ZW + "}";
                    sExtension = filename.Substring(filename.LastIndexOf('.'));
                    if (System.IO.Directory.Exists(savepath))
                        System.IO.Directory.CreateDirectory(savepath);
                    sNewFileName = filename.Substring(0, filename.IndexOf("."));
                    //新文件名
                    sNewFileName = System.DateTime.Now.ToString("yyyyMMddhhmmss") + (new Random().Next(20));
                    postedFile[0].SaveAs(savepath + @"\" + sNewFileName + sExtension);
                    res = "{\"status\" : \"success\",\"msg\": \"上传成功!\"}";
                    uploadpath = "FileUpLoad/Bbs/" + sNewFileName + sExtension;
                }

            }
            catch (Exception ex)
            {
                context.Response.Write("{\"status\" : \"error\",\"msg\": \"" + ex.Message + "\"}");
            }

        }
        else
        {
            res = "{\"status\" : \"success\",\"msg\": \"提交成功!\"}";
后面还有 145 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。