编程生产改写网址吗? [英] Programmatically Producing rewritten URLs?

查看:91
本文介绍了编程生产改写网址吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用IIS重写通过ASP.NET 4.0应用程序。有一些功能,我可以从内部ASP.NET调用将改变一个字符串的URL重写URL?我希望能在$ C $要做到这一点的C-落后。

Using IIS Rewrite over a ASP.NET 4.0 application. Is there some function I could call from within ASP.NET that would transform a string URL to the rewritten URL? I would like to be able to do this in code-behind.

事情是这样的:字符串ProduceRewrittenUrl(字符串publicUrl)

推荐答案

这是在 HttpContext.Current.RewritePath(串)

参考:
http://msdn.microsoft.com/en-us/library/system.web.httpcontext.rewritepath.aspx

一个全球性的地方称之为是保护无效的Application_BeginRequest(对象发件人,EventArgs五)的Global.asax

a global place to call it is the protected void Application_BeginRequest(Object sender, EventArgs e) on global.asax.

这篇关于编程生产改写网址吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆