ajax异步

通过ajax去请求数据,然后在js里面得到返回结果,赋值location.href

<div>
<input id="url" />
<button onclick="RedirectByAjax()">跳转页面</button>
</div>
<script>
function RedirectByAjax() {
//ajax请求完成一些工作
$.ajax({
type: "POST",
url: "/RedirectUrl/RedirectByAjax",
data: {
url: $("#url").val()
},
success: function (url) {
//得到结果,跳转页面
location.href = url;
}
});
}
</script>

form同步

通过post form表单提交数据,然后在表单对应的Action里面调用Redirect

<form id="redirectForm" name="redirectForm" action="/RedirectUrl/RedirectByForm" method="post">
<div>
<input id="url" name="url" />
<button id="submit" onclick="Submit()">登录</button>
</div>
</form>
<script>
function Submit() {
$("#redirectForm").submit();
}
</script>
[HttpPost]
public ActionResult RedirectByForm(string url)
{
return Redirect(url);
}

注意

二者不可混用,比如ajax请求+Redirect,这样返回的页面在Network请求里面,而不是实现跳转页面

其他

使用Response.Redirect 方法

使用Server.Transfer方法

使用Server.Execute 方法

使用javascript脚本(上面两种方式都属于这种)

使用超链接

示例代码

示例代码

asp .net 页面跳转的更多相关文章

  1. 总结asp.net页面跳转

    ASP.NET页面跳转相关知识 一.<a>标签   1. <a href=”test.aspx”></a>   2. 这是最常见的一种转向方法; eg:  < ...

  2. Asp.net页面跳转Session丢失问题

    原本去年在做项目时,写好的一记篇博客分享给大家. Asp.net页面跳转Session丢失问题   编写人:CC阿爸 2014-4-2 l  近来在做泛微OA与公司自行开发的系统集成登录的问题.在使用 ...

  3. ASP.NET页面跳转的三大方法详解

    ASP.NET页面跳转有什么方法呢?,现在给大家介绍三种方法,他们的区别是什么呢?让我们开始吧: ASP.NET页面跳转1.response.redirect 这个跳转页面的方法跳转的速度不快,因为它 ...

  4. asp.net页面跳转sessionid会变

    今天发现在一个Asp.net站点中, 同一次登录, 不停刷新页面或者页面跳转, 此时后台Session的SessionID总是变化的. 创建一个页面,添加一个button,后台代码非常简单,如下   ...

  5. ASP.NET页面跳转的三种方法比较

    在ASP.NET下,经常需要在页面之间跳转,下面我们来分别介绍一下关于.NET中Response.Redirect(),Sever.Execute(),Server.Transfer() 三种页面跳转 ...

  6. asp.net 页面跳转的方法

    目前知道有4种: 1超链接 2.response.redirect("urlString") 3.server.transfer("urlString") 4. ...

  7. ASP.NET页面跳转

    总结一下跳转方式: <a>标签 <a href=”home.aspx”></a> HyperLink控件 Asp.net 服务器端控件 属性NavigateUrl指 ...

  8. asp.net 页面跳转传值的几种方式

    参考地址: http://blog.csdn.net/zzzzzzzert/article/details/8486143 protected void Button1_Click(object se ...

  9. asp.net mvc && asp.net 页面跳转

    1.使用传统的Response.Redirect例如string url = "/account/create";Response.Redirect(url); 1.Server. ...

随机推荐

  1. C语言之基本算法11—牛顿迭代法求平方根

    //迭代法 /* ================================================================== 题目:牛顿迭代法求a的平方根!迭代公式:Xn+1 ...

  2. linux 内核驱动编程 简单例子 与_IO, _IOR, _IOW, _IOWR 宏解析

    一._IO, _IOR, _IOW, _IOWR 宏的用法与解析 在驱动程序里, ioctl() 函数上传送的变量 cmd 是应用程序用于区别设备驱动程序请求处理内容的值.cmd除了可区别数字外,还包 ...

  3. xv6进程切换-swtch函数

    https://blog.csdn.net/Swartz2015/article/details/61615603 xv6进程切换-swtch函数 进程切换中由于需要保存当前进程的寄存器状态信息,又要 ...

  4. linux 系统升级中的一些配置

    1. 关闭IPV6 vi /etc/sysconfig/network NETWORKING_IPV6=no    #掉 source /etc/sysconfig/network vi /etc/m ...

  5. [Ramda] Curry and Uncurry Functions with Ramda

    Most of the functions offered by the ramda library are curried by default. Functions you've created ...

  6. Ambari——大数据平台的搭建利器(一)

    Ambari 跟 Hadoop 等开源软件一样,也是 Apache Software Foundation 中的一个项目,并且是**项目.目前最新的发布版本是 2.0.1,未来不久将发布 2.1 版本 ...

  7. [React] displayName for stateless component

    We can use 'displayName' on component to change its component tag in dev tool: import React from 're ...

  8. js进阶 9-11 select选项框如何动态添加和删除元素

    js进阶 9-11 select选项框如何动态添加和删除元素 一.总结 一句话总结: 二.js进阶 9-11 select选项框如何动态添加和删除元素 1.案例说明 2.相关知识 Select 下拉列 ...

  9. Web开发四大作用域(转)

    Web开发中的四个域对象(范围由小到大): page(jsp有效)  request(一次请求) session(一次会话) application(当前web应用) page域指的是pageCont ...

  10. DownLoadManager[20530:228829] DiskImageCache: Could not resolve the absolute path of the old directory.

    uiwebview 模拟器打开PDF文件时崩溃.报下面错误,还不知道为什么 DownLoadManager[20530:228829] DiskImageCache: Could not resolv ...