Sky.Education.Upload/WebbHttpModule.cs

(开头部分) 11KB

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

namespace Sky.Education.Upload
{
    using System;
    using System.Collections;
    using System.IO;
    using System.Reflection;
    using System.Text;
    using System.Web;
    using System.Xml;

    internal class WebbHttpModule : IHttpModule
    {
        private DateTime m_beginTime = DateTime.Now;

        private byte[] AddTextPartToRequest(HttpWorkerRequest m_request, byte[] m_textData)
        {
            Type baseType;
            BindingFlags bindingAttr = BindingFlags.NonPublic | BindingFlags.Instance;
            if (HttpContext.Current.Request.ServerVariables["SERVER_SOFTWARE"].Equals("Microsoft-IIS/6.0"))
            {
                baseType = m_request.GetType().BaseType.BaseType;
            }
            else
            {
                baseType = m_request.GetType().BaseType;
            }
            baseType.GetField("_contentAvailLength", bindingAttr).SetValue(m_request, m_textData.Length);
            baseType.GetField("_contentTotalLength", bindingAttr).SetValue(m_request, m_textData.Length);
            baseType.GetField("_preloadedContent", bindingAttr).SetValue(m_request, m_textData);
            baseType.GetField("_preloadedContentRead", bindingAttr).SetValue(m_request, true);
            return m_textData;
        }

        private string AnalysePreLoadedData(byte[] m_preLoadedData, string m_fiedName)
        {
            string str = HttpContext.Current.Request.ContentEncoding.GetString(m_preLoadedData);
            if (str.Length > 0)
            {
                string str2 = "name=\"" + m_fiedName + "\"\r\n\r\n";
                int startIndex = str.IndexOf(str2) + str2.Length;
                int index = str.IndexOf("\r\n--", startIndex);
                return str.Substring(startIndex, index - startIndex);
            }
            return string.Empty;
        }

        private void ClearApplication(HttpApplication m_application)
        {
            if (m_application.Context.Items["Webb_Upload_Stream"] != null)
            {
                FileStream stream = (FileStream) m_application.Context.Items["Webb_Upload_Stream"];
                stream.Close();
                stream = null;
            }
            if (m_application.Context.Items["Webb_Upload_GUID"] != null)
            {
                string str = (string) m_application.Context.Items["Web_Upload_UploadGUID"];
                m_application.Application.Remove("Upload_Status_" + str);
            }
        }
后面还有 187 行代码,购买后查看完整代码

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

AI 解读

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

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