QuinnDester
asked on
Redirect using JavaScript and dynamic destination URL C#
I need to redirect the user from my redirect page to a dynamic url using JavaScript. in C# Code behind
I dont know how to pass the URL to the JavaScript in order for it to redirect.
I was using this
Response.AppendHeader("Ref resh", "1; URL=" + redirecturl + "\"");
but this doesnt work in older browsers for some reason.
only other way open to me is JavaScript as the page needs to load before the redirect
This is rather Urgent so any help offered is greatfully recieved
Thank you
I dont know how to pass the URL to the JavaScript in order for it to redirect.
I was using this
Response.AppendHeader("Ref
but this doesnt work in older browsers for some reason.
only other way open to me is JavaScript as the page needs to load before the redirect
This is rather Urgent so any help offered is greatfully recieved
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have tried this
HtmlGenericControl metaTag1 = new HtmlGenericControl("meta") ;
metaTag1.add("HTTP-EQUIV", "Refresh");
metaTag1.add("content", "60");
metaTag1.add("URL", redirecturl);
head.meta = metaTag1;
but this is giving me lots of errors
ie
System.Web.UI.HtmlControls .HtmlGener icControl' does not contain a definition for 'add' and no extension method 'add' accepting a first argument of type
and
Head' does not contain a definition for 'meta' and no extension method 'meta' accepting a first argument of type
HtmlGenericControl metaTag1 = new HtmlGenericControl("meta")
metaTag1.add("HTTP-EQUIV",
metaTag1.add("content", "60");
metaTag1.add("URL", redirecturl);
head.meta = metaTag1;
but this is giving me lots of errors
ie
System.Web.UI.HtmlControls
and
Head' does not contain a definition for 'meta' and no extension method 'meta' accepting a first argument of type
ASKER
got it using this in my code behind.
MyRefresh.ID = "MyRefresh";
MyRefresh.Attributes["cont ent"] = "1;url=" + redirecturl;
and this in the page code
<meta id="MyRefresh" http-equiv="refresh" runat="server"/>
thanks
MyRefresh.ID = "MyRefresh";
MyRefresh.Attributes["cont
and this in the page code
<meta id="MyRefresh" http-equiv="refresh" runat="server"/>
thanks
ASKER