我的雇主将MOSS 2007用于我们的公司内部网。它仅在安全的http上运行,并且还通过ISA暴露给外部世界。我目前要求在我们的网站上添加转发网址,以便发生以下情况:
intranet.mycompany.com/vanityname
重定向到 - >
intranet.mycompany.com/somedeeplink/default.aspx
我完全相信随着时间的推移,这种事情会越来越受到用户的欢迎。所以我正在寻找可扩展的解决方案。我已经阅读了有关创建/ site / with转发元标记或转发SharePoint页面类型的各种文章。我也看到一些关于直接在IIS中添加虚拟目录等的讨论。所有这些解决方案似乎都是过度的,并且不可避免地会占用更多的内存或处理Web服务器的时间。
我目前倾向于编写可以在web.config中配置的http模块并执行重定向。我想获得反馈,看看是否有其他人在SharePoint 2007中做过类似的事情并且有任何建议。同样,我想实现一些可以扩展的东西,而不会在以后进行重大更改,并且会给我们的Web服务器带来最小的处理负担。谢谢!
答案 0 :(得分:3)
我已经使用HTTP模块路由实现了与MOSS重定向的url。我记录了我使用的代码以及哪些参数对我来说最有效;
<击> http://scaredpanda.com/2008/08/url-rewriting-with-sharepoint-moss-2007/ 击>
如果您有任何疑问,请查看并告知我们。
更新:上面的链接不再有效,所以这里是我用于网址重定向的页面中的文字。
稍微乱了一下之后,我想出了一个很好的方法。当我在网上寻找例子时,有很多人说它无法完成。但最终它实际上并没有花太多时间来实现它。这是我写的一个HttpModule来做这项工作。
关键部分是this.app.BeginRequest + = new EventHandler(app_BeginRequest) 请求前面的步骤,并允许模块获取其重定向。
和HttpContext.Current.RewritePath(redirect,false);将向前推送必要的标题,以便接收.aspx页面将了解如何正确回发。
using System;
using System.Data;
using System.Data.SqlClient;
using System.Reflection;
using System.Collections;
using System.Text;
using System.Web;
using System.Web.Caching;
using System.Web.SessionState;
using System.Security.Cryptography;
using System.Configuration;
using System.Threading;
using System.IO;
using System.Security;
using System.Security.Principal;
namespace ScaredPanda
{
public sealed class RewriteHttpModule : IHttpModule
{
HttpApplication app = null;
///
/// Initializes the httpmodule
///
public void Init(HttpApplication httpapp)
{
this.app = httpapp;
this.app.BeginRequest += new EventHandler(app_BeginRequest);
}
public void app_BeginRequest(Object s, EventArgs e)
{
try
{
//determine if the income request is a url that we wish to rewrite.
//in this case we are looking for an extension-less request
string url = HttpContext.Current.Request.RawUrl.Trim();
if (url != string.Empty
&& url != "/"
&& !url.EndsWith("/pages")
&& !url.Contains(".aspx")
&& url.IndexOf("/", 1) == -1)
{
//this will build out the the new url that the user is redirected
//to ie pandas.aspx?pandaID=123
string redirect = ReturnRedirectUrl(url.Replace("/", ""));
//if you do a HttpContext.Current.RewritePath without the 'false' parameter,
//the receiving sharepoint page will not handle post backs correctly
//this is extremely useful in situations where users/admins will be doing a
//'site actions' event
HttpContext.Current.RewritePath(redirect, false);
}
}
catch (Exception ex)
{
//rubbish
}
}
}
}
答案 1 :(得分:2)
您是否查看了备用访问映射?
答案 2 :(得分:1)
如果您愿意支付解决方案。看看:
不免费 - &gt; http://www.muhimbi.com/Products/SharePoint-URL-Shortener.aspx
答案 3 :(得分:0)
根据您所希望实现的HTTP模块重定向的数量,但是如何检出
答案 4 :(得分:0)
使用IIS中的URL重写功能。 (我相信这是一个IIS 7扩展)