The error is self-explanatory, you are trying to add a control to the head element but head contains code blocks
var isMobileLogin = '<%= Session("isMobile") %>';
Move your script tag out of the header and put it somewhere else like at the top of the body.