【问题标题】:Using ViewBag in as route value in Html.BeginForm converts ViewBag value to lower case在 Html.BeginForm 中使用 ViewBag 作为路由值将 ViewBag 值转换为小写
【发布时间】:2014-06-20 20:35:00
【问题描述】:

我正在尝试通过 BeginForm 的路由集合传递加密字符串,方法是在 ViewBag 中传递它,例如:

@using (Html.BeginForm("Go", "Process", new { id = ViewBag.Id }, FormMethod.Post, new { @class = "seperate-sections fill-up form-horizontal", enctype = "multipart/form-data" }))

ViewBag.Id是动态加密的字符串如:g9IPGGXm4jw=

不幸的是,当它通过表单提交到达我的控制器时;它以小写形式出现,例如:g9ipggxm4jw=,这会导致解密过程出现异常。

有人知道它在哪里变成小写吗?

【问题讨论】:

  • 我认为是编码问题...

标签: asp.net-mvc encryption html.beginform


【解决方案1】:

我找到了答案。问题是路由!

我的路由强制小写定义为routes.LowercaseUrls = true;

所以它会自动将 url 转换为小写,我的加密被破坏了!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-14
    • 1970-01-01
    • 1970-01-01
    • 2015-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多