c# - MVC View Display Nonsense Data -


recently came across issue index view. page displays nonsense data seen in image link, result of usermanager.users.tolistasync(). start happening not sure why. on amazing!

the code pretty simple:

public virtual async task<actionresult> index() {     return view(await usermanager.users.tolistasync()); } 

the view

@model ienumerable<safeware.models.identity.applicationuser>  @{     viewbag.title = "index"; }  <h2>index</h2>  <p>  </p> <table class="table">     <tr>         <th>             @html.displaynamefor(model => model.username)         </th>         <th>          </th>     </tr>      @foreach (var item in model)     {         <tr>             <td>                 @html.displayfor(modelitem => item.username)             </td>             <td>                 @html.actionlink("edit", "edit", new { id = item.id }) |                 @html.actionlink("details", "details", new { id = item.id }) |                 @html.actionlink("delete", "delete", new { id = item.id })             </td>         </tr>     }  </table> 

onactionexecuting

protected override void onactionexecuting(actionexecutingcontext filtercontext) {     bool allowcompression = true;     //bool.tryparse(configurationmanager.appsettings["compression"], out allowcompression);      if (allowcompression)     {         httprequestbase request = filtercontext.httpcontext.request;          string acceptencoding = request.headers["accept-encoding"];          if (string.isnullorempty(acceptencoding)) return;          acceptencoding = acceptencoding.toupperinvariant();          httpresponsebase response = filtercontext.httpcontext.response;          if (acceptencoding.contains("gzip"))         {             response.appendheader("content-encoding", "gzip");             response.filter = new gzipstream(response.filter, compressionmode.compress);         }         else if (acceptencoding.contains("deflate"))         {             response.appendheader("content-encoding", "deflate");             response.filter = new deflatestream(response.filter, compressionmode.compress);         }     }     base.onactionexecuting(filtercontext); } 


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -