In ASP. net mvc, the return value of URL-related attributes in the Request object.
Request. OriginalString // return the original address, that is, the native content in the browser http: // localhost: 3638/Test/Show? Id = 1 Request. RawUrl // return a string that does not contain the Host Address information/Test/Show? Id = 1 Request. Query // parameters in the returned path. parameters are usually included in the/method in ASP. net mvc, but what is returned here? The value behind it, so the/mode parameter cannot be seen here? Id = 1 Request. Schema // return Request Type http Request. Port // return Port value 3638 Request. LocalPath // return? But does not include the Host information/Test/Show Request. PathAndQuery // returns the same content as RawUrl/Test/Show? Id = 1 Request. segments // returns a string array, which divides LocalPath into a string array ["/", "Test/", "Show"] Request. originalString // return the original address, that is, the native content in the browser http: // localhost: 3638/Test/Show? Id = 1Request. RawUrl // return a string that does not contain the Host Address information/Test/Show? Id = 1Request. Query // parameters in the returned path. parameters are usually included in the/method in ASP. net mvc, but what is returned here? The value behind it, so the/mode parameter cannot be seen here? Id = 1Request. Schema // return request type httpRequest. Port // return Port value 3638Request. LocalPath // return? But does not include the Host information/Test/ShowRequest. PathAndQuery // returns the same content as RawUrl/Test/Show? Id = 1Request. Segments // return a string array. Divide LocalPath into a/String Array ["/", "Test/", "Show"]
In a Controler or ActionFilter, if you want to obtain the name of the current Controller, Request. Segments [1]. If you want to obtain the name of the current Action, Request. Segments [2]