2012-07-16 76 views
0

我使用SharePoint 2010年,我创建的网站和子网站的匿名访问。SharePoint 2010中重定向到主页,匿名用户

匿名用户只能访问页面,但如果匿名用户播放或从 mysite的改变网址:80/site1的/页/ Default.aspx的,以

的mysite:80/site1的/页/或/页,他会得到登录提示。

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

回答

0

以及在这种情况下,你必须添加一个HTTP处理程序为Web应用程序(注册在web.config中的模块)

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")); 
    } 
} 
相关问题