I am attempting to redirect a page by pulling the url from the config file.
However, when I try the following code:
<script type="text/javascript">
<%string redirectUrl = System.Web.Configuration.WebConfigurationManager.AppSettings["RedirectURL"];%>
window.parent.location.replace("<%=redirectUrl%>");
</script>
the alligator tags <% %> are not being highlighted, and I am receiving the following error in the yellow screen:
the controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
What am I doing incorrectly??
Thanks!
Edit:
It does work if I directly insert the url into the code, like this:
window.parent.location.replace("http://theurl.com");
However, I need to dynamically change the url depending on other factors, so I require it to be in the config file :S