Pregunta

Mi empleador utiliza MOSS 2007 para la intranet de nuestra empresa. Se ejecuta únicamente en http seguro y también está expuesto al mundo exterior a través de ISA. Actualmente tengo una solicitud para agregar una URL de reenvío a nuestro sitio para que ocurra algo como lo siguiente:

intranet.mycompany.com/vanityname
redirige a - > intranet.mycompany.com/somedeeplink/default.aspx

Espero que este tipo de cosas se haga más popular entre nuestros usuarios a medida que pase el tiempo. Así que estoy buscando una solución que escale. He leído varios artículos sobre la creación de un / sitio / con metaetiquetas de reenvío o un tipo de página de reenvío de SharePoint. También he visto algunos que hablan sobre agregar directorios virtuales, etc. directamente en IIS. Todas estas soluciones parecen ser excesivas e inevitablemente requieren más memoria o tiempo de procesamiento en los servidores web.

Actualmente me inclino por escribir un módulo http que pueda configurarse en web.config y realizar redirecciones. Quería recibir comentarios para ver si alguien más ha hecho algo similar en SharePoint 2007 y tuvo alguna sugerencia. Una vez más, me gustaría implementar algo que se amplíe sin realizar cambios importantes más adelante y que supondrá una carga de procesamiento mínima para nuestros servidores web. Gracias!

¿Fue útil?

Solución

He implementado la redirección de URL con MOSS usando la ruta del módulo HTTP. Documenté el código que usé y los parámetros que mejor me funcionaron aquí;

http://scaredpanda.com / 2008/08 / url-rewriting-with-sharepoint-moss-2007 /

Eche un vistazo y déjeme saber si esto le ayuda y si tiene alguna pregunta.

Actualización: El enlace anterior ya no es válido, por lo que aquí aparece el texto de la página que usé para redireccionar URL.

Después de perder un poco el tiempo, se me ocurrió una buena manera de hacerlo. Cuando buscaba ejemplos en la web había mucha gente diciendo que no se podía hacer. Pero al final, en realidad no tomó mucho implementarlo. Aquí hay un HttpModule que escribí para hacer el trabajo.

Las piezas clave son this.app.BeginRequest + = new EventHandler (app_BeginRequest) que Pasos frente a la solicitud y permite que el módulo obtenga su redirección.

Y HttpContext.Current.RewritePath (redirect, false); empujará los encabezados necesarios hacia adelante para que la página .aspx receptora entienda cómo volver a publicar correctamente.

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
            }
        }
    }
}

Otros consejos

¿Ha examinado las asignaciones de acceso alternativas?

http://technet.microsoft.com/en-us/library /cc263208.aspx

Si está abierto a pagar por una solución. Echa un vistazo:

NO GRATIS - > http://www.muhimbi.com/Products/SharePoint-URL-Shortener. aspx

Dependiendo de la cantidad de redirecciones, es posible que desee implementar un módulo HTTP como se indica), pero ¿qué hay de retirar

GRATIS - > http://www.codeplex.com/sharepointsmart404

Use la función de reescritura de URL en IIS. (Creo que es una extensión de IIS 7)

http://www.iis.net/download/urlrewrite

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top