On my site, I have it set up so that a different css file is loaded
depending on the users screen resolution. This works fine.
When the user visits a page in my site, the sessoin variable 'screenres' is
checked for a value. If it has a value, then the page loads with the correct
css file for the screen res. If 'screenres' has no value, the user is sent
to a page titled 'detectscreenres.aspx' , where the res is disovered via a
JavaScript function that passes a value to Session("screenres"). Again, this
all works properly.
The problem I am having is that if a user bookmarks a page, or another site
deep-links to one of my pages, they are automatically redirected to
'default.aspx by the page code. It's the only way I can get it to work.
Here is the code for 'detectscreenres.aspx':
<head>
</head>
<script runat="server" language="C#">
public void Page_Load(Object sender, EventArgs e){
if (Request.QueryString["action"] != null) {
// store the screen resolution in Session["ScreenResolution"]
// and redirect back to default.aspx
Session["ScreenResolution"] =
Request.QueryString["res"].ToString();
Response.Redirect("../default.aspx");
}
}
// JavaScript code below will determine the user screen resolution
// and redirect to itself with action=set QueryString parameter
</script>
<HTML><BODY>
<script language="javascript">
res = "&res="+screen.width+"x"+screen.height+"&d="+scree n.colorDepth
top.location.href="detectscreen.aspx?action=set"+r es
</script>
</BODY></HTML>
So, how can I redirect them back to their originally requested page after
visiting 'detectscreenres.aspx'?