Viewbag check to see if item exists and write out html and value error September 6, 2023 by Tarik Don’t use Response.Write. Instead do this: @if (ViewBag.UserExists != null) { <h3>@ViewBag.UserExists</h3> }