简体   繁体   English

Google网站搜索受保护的页面

[英]Google site search for protected pages

My website includes subscription based pages, meaning that the content in those pages are password protected. 我的网站包含基于订阅的页面,这意味着这些页面中的内容受密码保护。 I would like to implement a site search, and have these protected pages appear in the search results, but require login in order to view them. 我想实施站点搜索,并将这些受保护的页面显示在搜索结果中,但需要登录才能查看它们。

What I thought about, is creating, for each protected page, an unprotected version, and then in each of these uprotected pages do a redirect on page load to the protected version. 我想到的是为每个受保护的页面创建一个不受保护的版本,然后在这些受保护的页面的每一个中,将页面加载时重定向到受保护的版本。

Are there better ways of doing this ? 有更好的方法吗?

There are some ways that you can do that more easy. 您可以通过某些方法更轻松地完成此操作。 Let say that you won to make it fully automatically on all page, then you go to the global.asax , on the AuthenticationRequest and if you see that is a google crawler, or a crawler in general you automatically loggin him with a simple login name. 假设您赢了,将使其在所有页面上完全自动运行,然后转到AuthenticationRequest上的global.asax ,如果看到它是google搜寻器,或一般而言,则您会使用简单的登录名自动将其登录。

Must have in mine that any one can set a false browser id and see your "protected page". 必须确定任何人都可以设置错误的浏览器ID并查看“受保护的页面”。 And the code can be: 代码可以是:

protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
   // if its crawler - or check for what else you wish for
   if(HttpContext.Current.Request.Browser.Crawler){      
       // then log him automatically using the 'OneName' user
       FormsAuthentication.SetAuthCookie("OneName", false);       
   }
}

relative: http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.setauthcookie.aspx 相对的: http : //msdn.microsoft.com/zh-cn/library/system.web.security.formsauthentication.setauthcookie.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM