title: Localization (Change culture globally)
body: <p>I try to change language in asp.net core with razor pages and PageModels(without controllers), but the problem is my localization working just for Pages/Index Page. When i  try to switch language on another pages it is handled by their OnPost methods and got NullPointer.</p>
  <pre><code>  &lt;div class=&quot;dropdown-menu&quot; aria-labelledby=&quot;navbarDropdown&quot;&gt;
      
          @foreach (var culture in cultureItems)
              {
      
                  &lt;form id=&quot;selectLanguage&quot; asp-page=&quot;/&quot; asp-route-returnUrl=&quot;@Context.Request.Path&quot;
                                                            method=&quot;post&quot; class=&quot;form-horizontal&quot; role=&quot;form&quot;&gt;
                      &lt;input class=&quot;dropdown-item  waves-effect waves-light&quot; type=&quot;submit&quot; name=&quot;culture&quot; value=&quot;@culture.Value&quot; /&gt;
      
                  &lt;/form&gt;
              }
  
  &lt;/div&gt;
  </code></pre>
  <p><strong>My handler method:</strong></p>
  <pre><code>public void OnPost(string culture, string returnUrl)
      {
          Response.Cookies.Append(
                                                     CookieRequestCultureProvider.DefaultCookieName,
                                                     CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)),
                                                     new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1) }
                                                 );
  
          return LocalRedirect(returnUrl ?? &quot;/&quot;);
      }
  
                                     
  </code></pre>