i cant see from the razor view if the Http request is a postback
in MVC 5 we had the IsPost
but it does not work by me on MVC 6
i cant even get the Request object in the view
you could create a extension method on ViewContext to access ViewContext.HttpContext.Request and check for the Method. Possibly like this:
public static class ViewContextExtensions
{
public static bool IsPost(this ViewContext viewContext)
{
return viewContext.HttpContext.Request.Method == "POST";
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With