asp.net - Loading a css file dynamically? Code inside -


i have following code in <head>

<% if(context.user.isinrole("reseller")) {%> <link href="<%: themelocation %>" rel="stylesheet" type="text/css" /> <%} else {%> <link href="<%= url.content("~/content/custom-theme/jquery-ui-1.8.5.custom.css") %>" rel="stylesheet" type="text/css" /> <%} %> 

the issue themelocation, declared above block of code - so:

<%     var reseller = new reseller();     var storesettings = new storesettings();     var themelocation = "";     if (context.user.identity.isauthenticated)     {         var resellerrepository = new resellerrepository();         reseller = resellerrepository.getresellerbyusername(context.user.identity.name);          var storesettingsrepository = new storesettingsrepository();         storesettings = storesettingsrepository.getstoresettings((int) reseller.storesettingsid);          themelocation = storesettings.theme.stylesheetlocation;     } %>  

setting break point shows themelocation holds string need, when page run - generates 400 - bad request error, , net tab in firebug reveals looking this:

http://localhost:50982/%3c%:%20themelocation%20%%3e 

where going wrong here? why using variable name, , not contains?

i'm using asp.net mvc2, , of code located on master page.

i did artem k. suggested , removed runat='server' , code executed properly.


Comments

Popular posts from this blog

sql server - python to mssql encoding problem -

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -