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

user737
1#
user737 Published in May 21, 2018, 10:35 pm

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.244271 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO