RedirectToAction不列入更改浏览器的URL [英] RedirectToAction doesnot change the browser URL

查看:101
本文介绍了RedirectToAction不列入更改浏览器的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着做下面的语法从账户控制(客户/登录)到用户/指数重定向。

I was trying to redirect from the Account controller (Account/Login) to User/Index by doing below syntax.

return RedirectToAction("Index", "User");

它显示了正确的观点,但网址仍然存在的账户/登录。任何人都可以建议我怎么能达到同样的。我曾尝试一些搜索从谷歌,但没有人对我的作品。

it shows up the correct view but the URL still persist as Account/Login. Can anyone suggest how can i achieve the same. I have tried some of the searches from google but none of them works for me.

推荐答案

这是造成的jQuery移动的问题。默认情况下,JQM将使形式使用AJAX调用,因为这是页面导航如何在框架进行。 AJAX导航在这里详细说明。

It's an issue caused by jQuery-mobile. By default, jQM will make forms use ajax calls, as this is how page navigation is performed in the framework. AJAX navigation is explained in more detail here.

该解决方案是增加数据AJAX =FALSE来用于初始服务器调用表单标签。

The solution is to add data-ajax="false" to the form tag used for the initial server call.

所以你的形式是这样的:

So your form would look like this:

@using (Html.BeginForm("Login", "Account", FormMethod.Post, new { data_ajax = "false" }))

这篇关于RedirectToAction不列入更改浏览器的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆