SharePoint 2010重定向到匿名用户的主页

SharePoint 2010重定向到匿名用户的主页,sharepoint,iis-7,sharepoint-2010,Sharepoint,Iis 7,Sharepoint 2010,我正在使用SharePoint 2010,我创建了网站和子网站作为匿名访问 匿名用户只能访问页面,但如果匿名用户从 mysite:80/site1/Pages/default.aspx至 mysite:80/site1/Pages/或/Pages,他将得到登录提示 我的问题:如何改变这种行为,我的意思是当用户更改URL时,立即重定向到主页或在没有登录提示的情况下访问被拒绝的页面(我更喜欢主页)???在这种情况下,您必须为web应用程序添加http处理程序(在web.config中注册模块) pu

我正在使用SharePoint 2010,我创建了网站和子网站作为匿名访问

匿名用户只能访问页面,但如果匿名用户从 mysite:80/site1/Pages/default.aspx至

mysite:80/site1/Pages/或/Pages,他将得到登录提示


我的问题:如何改变这种行为,我的意思是当用户更改URL时,立即重定向到主页或在没有登录提示的情况下访问被拒绝的页面(我更喜欢主页)???

在这种情况下,您必须为web应用程序添加http处理程序(在web.config中注册模块)

public void Init(HttpApplication上下文)
{
context.PreRequestHandlerExecute+=新事件处理程序(PreRequestHandlerExecute);
}
公共空间处置()
{
}
/// 
///Pres请求处理程序执行。
/// 
///发送者。
///包含事件数据的实例。
void PreRequestHandlerExecute(对象发送方,事件参数e)
{    
if(HttpContext.Current.Request.Path==“/\u layouts/Authenticate.aspx”)
{
HttpContext.Current.Response.Redirect(url.Replace(“/\u layouts/Authenticate.aspx”,“/HOME\u PAGE.aspx”);
}
}
public void Init(HttpApplication context)
{
    context.PreRequestHandlerExecute += new EventHandler(PreRequestHandlerExecute);
}

public void Dispose()
{
}

/// <summary>
/// Pres the request handler execute.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
void PreRequestHandlerExecute(object sender, EventArgs e)
{    
    if(HttpContext.Current.Request.Path == "/_layouts/Authenticate.aspx")
    {
        HttpContext.Current.Response.Redirect(url.Replace("/_layouts/Authenticate.aspx", "/HOME_PAGE.aspx"));
    }
}