アイブ氏は、HTTPモジュールのルートを使用してMOSSとリダイレクトURLを実装
自由ではない:顔をしています。私が使用したコードと、ここで私にとって最も効果的なパラメータは何かを文書化しました。
http://scaredpanda.com/2008/08/url-rewriting-with-sharepoint-moss-2007/
を見て、これはあなたを助け、ご質問があればあれば私に知らせてください。
更新:上記のリンクは有効ではないため、ここではURLリダイレクトに使用したページのテキストを示します。
ちょっと迷ってしまったので、私はそれを行う良い方法を思いついた。私がウェブ上で事例を探しているとき、それはできないと言っている人がたくさんいました。しかし、実際にはそれを実装するのにあまり時間がかかりませんでした。ここに、私が仕事をするために書いたHttpModuleがあります。
鍵の部分はthis.app.BeginRequest + =新しい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
}
}
}
}
おかげで、フィードバックを検討した後、これは私の状況に最も適した(私はそれがIIS 7の拡張だと考えています)。私はあなたのコードを見て、私のニーズに正確に合うようにリファクタリングすることができました。私はそれを投稿したいと思いますが、コメントシステムが私に(十分な文字ではない)ように見えるように見えません。再度、感謝します! –
これは今日の私の問題を解決するために必要なものでした。私は実際に構築したカスタムのsharepointリストからURLマッピングへの虚栄心を読み取ってしまいました。 +1 – Hardwareguy