Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Excaption in ASP.Net Core web app after deploy

$
0
0

I have a .Net Core web app that is throwing an error when I deploy it. Everything runs fine if I run it from Visual Studio (2017). After I deploy it, I get an error when I try to go to one of the views. that view calls a controller,which si where the error is happening. Its a System.NullReference exception: object not set to an instance of an object. The offending line of code appears to be this:
ViewBag.UserId = User.Identity.Name.Remove(0, 4).

I'm using that to set the value in a text control on the view. Any idea what I am missing?


Viewing all articles
Browse latest Browse all 9386

Trending Articles