0

Request.RawUrllocalhost の後に URL を取得するためにa を使用していました。つまり、私の URL がlocalhost:52482/something/somethingelseの場合、これは以前は を返していました/something/somethingelse

私はベースコントローラー(MVC3)でこれにアクセスしました。これを解決するにはどうすればよいですか?

クエリ文字列なしで URL だけを取得できるかどうかを確認するために、javascript でこの操作を実行することを考えていました。ここでどのように進めればよいか教えてください。

ありがとう、アダーシュ

4

1 に答える 1

2

http://www.w3schools.com/jsref/obj_location.asp

// testsite.com/test.html?q=blah

var urlWithoutQS = window.location.host + window.location.pathname

alert(urlWithoutQS);                // testsite.com/test.html
alert(urlWithoutQS.split('/')[0]);  // testsite.com
alert(urlWithoutQS.split('/')[1]);  // test.html
于 2011-12-13T05:05:04.727 に答える