2012-11-09 53 views
1

我在登录到名为CustomerStart的页面后成功重定向用户。该查询字符串(URL)后看起来很好,像这样在多个视图中传递查询字符串的值MVC3

localhost:1234/CustomerStart?ssn=850406-0297 

的SSN我写这

return RedirectToAction("Index", "CustomerStart", new {ssn = model.ssn}); 

做这个但是,当我点击一个按钮,它已经在这样的_layout被定义,

<li>@Html.ActionLink("CustomerStart","Index", "CustomerStart")</li> 

我的查询字符串变空了。

我想要让我的客户在登录后或如果他们单击CustomerStart按钮时保持在同一个CustomerStart页面中。

我还想在不同的视图中发送我的客户,当他们点击上述提到的一个按钮。

这样,

<li>@Html.ActionLink("CustomerStart","Index", "CustomerStart")</li> 
<li>@Html.ActionLink("Bill","Index", "Bill")</li> 

所以,我要抓住从查询字符串总是值。但我不知道如何?

我是新的MVC3,我完全失去了。

+0

任何帮助吗?请......( – Aqua

回答

0

尝试

<li>@Html.ActionLink("CustomerStart","Index", "CustomerStart", 
        new { ssn=Request.QueryString["ssn"]}, 
        null) 
</li> 
<li>@Html.ActionLink("Bill","Index", "Bill", 
        new { ssn=Request.QueryString["ssn"]}, 
        null) 
</li> 
+0

)非常感谢你的回复,我已经尝试过这个,之后出现了两个问题,编译器说它无法解析动作“索引”,并且在url中看起来像http:// localhost:1234/CustomerStart?Length = 13这就是为什么它失去了我在视图中检索到的客户信息 – Aqua

+0

更新了答案... – Rafay

+0

作品当我点击拳头时间,但如果我点击另一个按钮,并再次点击它它的丢失:( – Aqua

相关问题