You can use var variable name = "<%=this.variable%>" to get value from aspx.cs. Variable must be public , protected in aspx.cs file.
For example, you can use: var date=”<%=DateTime.Now%>”; to get the server time.
For example, you can use: var date=”<%=DateTime.Now%>”; to get the server time.