title: How can I convert ViewData to String in .net core?
body: <p>I saved a string as viewdata in @ViewData["ShopURL"]
  <br/>
  <br/>
  When I just render it in razor page like this:</p>
  
  <pre><code>&lt;a id="ShopA" href="@ViewData["ShopURL"]"&gt;123&lt;/a&gt;
  </code></pre>
  
  <p><br/>
  It works well.
  <br/>
  <br/>
  Now I want to do this that if the ShopURL is null or empty then the ShopA will not display.
  <br/>
  So I make my code like this:</p>
  
  <pre><code>@{
              string ShopViewData= ViewData["ShopURL"].ToString();;
              var ShopURL = "";
                  if (!string.IsNullOrEmpty(ShopViewData))
                  {
                      ShopURL = "&lt;a id="ShopA" href='" + ShopViewData+ "'&gt;&lt;/a&gt;";
                  }
          }
          @Html.Raw(ShopURL)
  </code></pre>
  
  <p>The problem is the ShopViewData do not return what the string in @ViewData["ShopURL"],but just something strange like "Microsoft.AspNetCore.Mvc.Localization.LocalizedHtmlString".
  <br/>
  <br/>
  So,how can I convert ViewData to String?</p>