开发者

How to avoid a query string parameter being remembered?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜