如何阻止一个网站编程方式使用DOTNET的方式、网站、DOTNET

由网友(百撕不得骑姐)分享简介:我正在开发一个Windows应用程序来使用DOTNET的窗户programming.I计算机阻止网站上找到了一些成果来阻止URL而不是一个网站。这是我必须阻止完整的网站不是一个单一的URL。I am developing a windows application to block the websites from...

我正在开发一个Windows应用程序来使用DOTNET的窗户programming.I计算机阻止网站上找到了一些成果来阻止URL而不是一个网站。这是我必须阻止完整的网站不是一个单一的URL。

I am developing a windows application to block the websites from a computer using DotNet windows programming.I found some results to block an url but not for a website. That is I have to block complete website not a single url.

所以,可以有一个人帮助我解决这个问题。

So can some one help me to solve this problem

感谢你

Chaithanya

Chaithanya

推荐答案

这听起来像你想的System.Uri类的服务(的 http://msdn.microsoft.com/en-us/library/system.uri.aspx )。我猜,在某些时候,你必须决定你是否会允许或禁止基于URI的请求,在这种情况下,你会希望类似的逻辑如下:

It sounds like you want the services of the System.Uri class (http://msdn.microsoft.com/en-us/library/system.uri.aspx). I'm guessing that at some point you have to decide whether or not you are going to allow or disallow a request based on the URI, in which case you will want logic similar to the following:

Uri uri = new Uri("http://www.google.co.uk/somepage.html");
if (uri.Host.ToLower().EndsWith("google.co.uk"))
{
    // Do something
}

实验用类似的东西。需要注意的事项是:

Experiment with something like that. Things to note are that:

如果您检查,看看是否主机等于www.google.co.uk,那么这仍然意味着其他子域(例如www3.google.co.uk)不会是阻止。 如果您检查,看看是否主机包含google.co.uk,那么你就有可能阻止他人的子域包含(愚蠢的原因),别人的URL,例如google.co.uk.MyDomain.co.uk 这仍然是在一个有效的(如果愚蠢)的子域MyDomain.co.uk域。
阅读全文

相关推荐

最新文章