ASP.net ustawia wartość na ukrytą kontrolę formularza
W ASP.net próbuję ustawić wartość zmiennej na ukryte pole, ale otrzymuję wyjątek.
W pierwszym wyjściu jest poprawne. potem umieściłem go w ukrytym polu, nie powiodło się.
Jak to naprawić ?
user name: <%= User.Identity.Name %> // output is correct
<form runat=Server>
<asp:HiddenField id="HiddenField1" value=<%= User.Identity.Name %> runat=Server />
</form>
błąd
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Server tags cannot contain <% ... %> constructs.