An exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in System.Core.dll but was not handled in user code.Additional information: Cannot apply indexing with  to an expression of type 'System.Dynamic.DynamicObject'.When I am trying to assign a value to the ViewBag in my actionname and afte that I get the as the given ablove.
My code is as follows:
public ActionResult Login(string returnUrl)
ViewBag["ComapanyName"] = "";
ViewBag.ReturnUrl = returnUrl;
Change the ViewBag keyword to ViewData and this should work because ViewBag is just a wrapper for ViewData.
ViewData, you access the items by indexing the appropriate key from the key value dictionary like this.
ViewBag and ViewData seem kind of interchangable, but there are different between how you access the data inside of them. Your issue pops up when you try to index into a ViewBag, which doesn't work.
Change ViewBag to ViewData like as: