Common/UrlTools.cs

(开头部分) 5KB

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

using System;
using System.Collections.Generic;
using System.IO;
using System.Web;
using System.Text;

// UrlTools.cs
// CopyRight (c) 2009-2016 WMPT Teconology. All Rights Reserved.
// 123@163.com.com
// 2010-04-01
// 伪静态处理类
   
// public class HttpModule : System.Web.IHttpModule
// <httpModules>
//     <add type="WMPT.Common.HttpModule,WMPT.Common" name="HttpModule" />
// </httpModules>

namespace WMPT.Common
{
    public static class UrlTools
    {
        /// <summary>
        /// 重定向请求
        /// 如果传入的是ashx后缀的请求页面则需要重定向到正确的页面中
        /// 一般格式 
        /// 1.点餐商家:http://www.dianyifen.com/togo.show-1.ashx -> http://www.dianyifen.com/togo.aspx?id=1
        /// 2.订餐商家:http://www.dianyifen.com/order.show-1.ashx -> http://www.dianyifen.com/order/showpub.aspx?id=1
        /// 3.在线超市:http://www.dianyifen.com/market.show-1.ashx -> http://www.dianyifen.com/market/showmarket.aspx?id=1
        /// </summary>
        public static void RouteCurrentRequest()
        {
            //提取物理地址 togo.show-1
            //string pageName = Path.GetFileNameWithoutExtension(HttpContext.Current.Request.PhysicalPath);
            
            //获取后缀
            string ext = Path.GetExtension(HttpContext.Current.Request.PhysicalPath).ToLowerInvariant();

            if (ext.Length > 0)
            {
                ext = ext.Substring(1);
            }

            //非ashx页面不予处理 如 .aspx .jpg .css .js .html
            if (ext != "ashx")
            {
                return;
            }

            //提取物理地址 90
            string pageName = Path.GetFileNameWithoutExtension(HttpContext.Current.Request.PhysicalPath);

            // Extract the current namespace, if any
            //提取当前请求的板块(在线点餐、在线订餐、在线超市、积分对换) 定义为命名空间
            string queryString = HttpContext.Current.Request.Url.Query.Replace("?", "&");
            string name_space = GetCurrentNamespace();

            //有命名空间
            if (!string.IsNullOrEmpty(name_space))
            {
                if (name_space.Equals("shop"))
后面还有 80 行代码,购买后查看完整代码

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

AI 解读 AI

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

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