In the ASP.net, I try to set a variable value to hidden field, but I get exception.
In the first output, it is correct. then I put it into hidden field, failed.
How to fix it ?
user name: <%= User.Identity.Name %> // output is correct
<form runat=Server>
<asp:HiddenField id="HiddenField1" value=<%= User.Identity.Name %> runat=Server />
</form>
error
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.
Give quote around your scriplet like given below.
Change
To