What is the name of this URL part?

2019-08-28 03:10发布

问题:

If I have a URL:

http://mysite.com/part1/page.aspx

What is the name of the part1 part in that URL?

回答1:

Justin is correct - it's one part of the path. Adding a reference to the URI RFC, for the pretty picture contained therein, which illustrates (in section 3) each part of an example URI:

  foo://example.com:8042/over/there?name=ferret#nose
  \_/   \______________/\_________/ \_________/ \__/
   |           |            |            |        |
scheme     authority       path        query   fragment

Further on, in the section devoted to the path:

A path consists of a sequence of path segments separated by a slash ("/") character. A path is always defined for a URI, though the defined path may be empty (zero length). Use of the slash character to indicate hierarchy is only required when a URI will be used as the context for relative references. For example, the URI has a path of "fred@example.com", whereas the URI has an empty path. (emphasis mine)

And so "path segment" might be the term you're looking for.



回答2:

That would be the first part of the path. There's no term to describe that part alone.



回答3:

I might possibly be name "the protocol"?



标签: asp.net http url