1

オプションのパラメーターを使用してアクションを別の URL にリダイレクトし、変数をコントローラーに渡しています

RedirectToAction("action", new { a, c, s,ds});

but my urls loosk like this 

http://localhost:8080/contoller/action?a=1&c=2&s=3&ds=4

but when i directly call teh action the url looks like this 

http://localhost:8080/contoller/action/1/2/3/4

how can i get the same url with redirect ..any suggestion 
4

1 に答える 1

0

これを試しましたか?(うまくいくかどうかはわかりません)

    RedirectToAction("action", new { a = a, c = c, s = s,ds = ds});

汚いメソッドは次のとおりです。

    Redirect("/area/home/action?a=" + a + "&b=" + b + "&c=" + c + "&ds=" + ds);

実際、私は 2 番目のものを頻繁に使用します。すべてのパラメーターと値をより明確に確認できるからです。唯一の欠点は、URL にエラーがあっても警告がないことです。

于 2013-08-28T10:16:46.477 に答える