简体   繁体   English

在http请求中找到URL的默认页面(即index.php / default.aspx)

[英]Find the default Page (i.e index.php/default.aspx) for a URL in http Request

I am just wondering if there is a way to find out a sites default page (ie index.php, default.aspx or custom!) automatically through a http request or similar in C#. 我只是想知道是否有一种方法可以通过http请求或C#中的类似请求自动找出网站的默认页面(即index.php,default.aspx或custom!)。 I have looked in the header response and there doesn't seem to be anything which gives this information. 我查看了标头响应,似乎没有提供此信息的任何内容。

Any help would be great! 任何帮助将是巨大的!

Technically there is no such thing as a default page. 从技术上讲,没有默认页面之类的东西。 Just a page that happens to be in the root directory or that you are directed to when you request the root. 只是一个页面恰好位于根目录中,或者在您请求根目录时被定向到的页面。 It'll certainly not be in a request, because then you would already know. 当然不会在请求中,因为那样您就已经知道了。 That would be like sending someone a letter to tell them what street they live in. A server might send you a redirect response when you request the root of the website, if so, then you will know what it considers to be it's own 'default page', if not, you'll have to asume its just the root itself. 这就像向某人发送一封信以告诉他们他们住在哪条街上。当您请求网站的根目录时,服务器可能会向您发送重定向响应,如果是这样,那么您将知道它认为是自己的“默认”页”(如果没有),则必须假定它只是根本身。

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

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