Home Block passing URL's parameter inside action method to the view
Reply: 0

Block passing URL's parameter inside action method to the view

krypru
1#
krypru Published in 2017-11-15 08:12:53Z

Is there any possibility to block (by attribute for example) passing URL's parameters into view?

public ActionResult UserForm(Guid? entityId, bool isCopy = false)
{
    ViewBag.IsNewOrCopy = entityId.IsNullOrEmptyOrCopy();

    if (ViewBag.IsNewOrCopy)
        return View(new UserFormViewModel() {Roles= service.GetRoles(entityId, isCopy) });

    return View(service.GetUser(entityId.Value));
}

For example I would like to stop passing entityId parameter because when I update changes via post method the entityId (@Html.HiddenFor(m => m.EntityId)) is also passed via viewmodel although I would like it to be passed as null variable.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.311102 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO