qianbao

文采有限,写不出系统的文章....所以只能记录一些小小的知识点
没有真正的捷径能绕过黑暗直达黎明..

记录一下,URL地址转发

     第一种:(最简单的方式) Global.asax里填加代码
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            
string url = Request.RawUrl;
            
//处理。。。
            HttpContext.Current.RewritePath(newUrl);
        }

    第二种:用插件 Intelligencia.UrlRewriter.dll  (官方:http://urlrewriter.net)(填加引用就不用说了),下面为web.config配置抽出的代码
<configuration>
    
<configSections>
        
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
    
</configSections>
    
<system.web>
        
<httpModules>
            
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
        
</httpModules>
    
</system.web>
    
<rewriter>
        
<rewrite url="~/Default-(.+).aspx" to="~/Default.aspx?id=$1" />
    
</rewriter>
</configuration>

posted on 2008-01-16 17:28 qianbao 阅读(43) 评论(0)  编辑 收藏 所属分类: Asp.Net


标题  
姓名  
主页
Email (只有博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2008-05-31 18:32 编辑过


相关链接: