开发者

How to avoid a query string parameter being remembered?

开发者 https://www.devze.com 2023-03-12 04:19 出处:网络
I\'m developing a messaging system on a website. When user sends a message, she is redirected to inbox?status=sent which displays a neat status Message sent.

I'm developing a messaging system on a website.

When user sends a message, she is redirected to inbox?status=sent which displays a neat status Message sent.

However, if she then goes on to see any of the inbox messages and clicks Back, she is brought to this statusful page again, whereas I don't want to display it a开发者_运维技巧nymore.

What is the standard way to handle this?


You could try using TempData

[HttpPost]
public ActionResult SendMessage()
{
    // TODO: send the message

    TempData["status"] = "sent";
    return RedirectToAction("Result");
}

and in the Result view you could show the message by fetching it from TempData:

<div>@TempData["status"]</div>
0

精彩评论

暂无评论...
验证码 换一张
取 消