![](/img/trans.png)
[英]Redirect to Login page after session expire or idle time in MVC application using ASP.net core C#
[英]Redirect to previous page URL in asp.net core using MVC - c#
我四處搜索,發現有些人建議使用以下行。 但這讓我獲得了當前的網址,而不是上一頁的網址。
Request.Headers["Referer"].ToString();
我嘗試使用以下命令訪問以前的 url,但收到錯誤消息,說Http 請求不包含 UrlReferrer 的定義
Request.UrlReferrer.ToString();
也試過像這樣使用Current
HttpContext.Current
但仍然收到錯誤消息,說http 請求不包含 current 的定義。 也試過“System.Web.HttpContext.Current”但收到錯誤。 我在這里缺少什么?
當您導航到下一個位置時,您應該傳遞當前位置,例如登錄中的returlurl
。 為此沒有任何內置功能。
<a href="/nexlocation?returnurl=currenturl">my link</a>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.