是否有一个直接的指令的Response.Redirect去previous页? [英] Is there a direct instruction for RESPONSE.REDIRECT to go to previous page?

查看:119
本文介绍了是否有一个直接的指令的Response.Redirect去previous页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个收件箱中的Web应用程序(服务台票务系统)来监视传入的请求,并取得了一定的过滤器按钮,帮助基于请求者名称,创建日期等用户安排的请求。

I have a Web application (Help Desk Ticket System) with an inbox to monitor incoming requests and made some filter buttons that help the user arrange the requests based on requester name, creation date, etc.

每个过滤器会简单地调用相同的页面,但会增加一些code到查询字符串。
例如,如果用户presses标记为[按日期排序]按钮这里是落后于该按钮的code:

Every filter will simply call the same page but will add some code to the query string. Example, if the user presses a button labeled [Sort by Date] here is the code behind for that button:

Response.Redirect("Inbox.aspx?Filter=DATE")

另一个按钮将同样执行:

another button will similarly execute:

Response.Redirect("Inbox.aspx?Filter=NAME")

一个GridView控件将某些行(传入的请求摘要)用户的preference进行填充,并下令。

A GridView will be populated with some rows (Summary of the incoming requests) and ordered by the preference of the user.

一旦用户决定查看全部细节的任何传入的请求,对任何行点击会导致

Once the user has decided to view the full details any of the incoming requests, a click on any row will lead to

Response.Redirect("Details.aspx?REQ_ID=123") 
'where 123 is the request number the user clicked

然后,用户被赋予一个机会更新/编辑使用Details.aspx页上几个按钮请求,但每个按钮将需要用户与过滤器的preference该用户不得不返回到收件箱中前vising的Details.aspx页。

Then the user is given a chance to update/edit the request using several buttons on the Details.aspx page, but every button will need to return the user to the inbox with the preference of filter that the user had before vising the Details.aspx page.

在换句话说,我想做到以下几点一旦用户presses的Details.aspx页面上的一个按钮

In other words, I would like to do the following once the user presses a button on the Details.aspx page

    Sub btnUpdateRequest() Handles btnUpdateRequest.Click

    'My code here for the button action (update/edit/send/cancel)
    ' once the job is done, return the user to the Inbox.aspx page with the same filter

    Response.Redirect("javascript:History.Back()")
    End Sub

但我知道的Response.Redirect不接受JavaScript,我不想要分割code之间的code文件的背后,ASPX文件(添加的OnClientClick属性),因为我需要执行无论VB指令,也将用户重定向。

But I know that Response.Redirect does not accept javascript, and I don't want to split the code between Code Behind file, and ASPX file (adding OnClientClick attribute) because I will need to perform both VB instructions and also redirecting the user.

推荐答案

您可以重定向到URL引荐。你应该先检查一下,看它是否是可用的。

You could redirect to the referrer URL. You should probably check first to see if it is available.

if (Request.UrlReferrer.AbsoluteUri != null) {
    Response.Redirect(Request.UrlReferrer.AbsoluteUri);
}

这篇关于是否有一个直接的指令的Response.Redirect去previous页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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