我想在jQuery(v 1.9.1)中獲得會話。獲取會話問題
我用下面的代碼:
<script>
var testUser = '<%= Session["User"] %>';
alert(testUser);
</script>
,但我得到了以下錯誤:
"The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)."
"Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)"
在這裏討論的類似問題:http://stackoverflow.com/questions/778952/the-controls-collection-cannot-be-modified-because-the-control-contains-code-bl – Riv
Tanks.I add'Page。 Header.DataBind()'在aspx和工作正常:)。 – ZSH