A couple of comments...
The HTTP_REFERER variable must be populated by a click event
or the variable will contain no data.
I see you are literate but the lames that created this variable way back
when were not and their illiteracy found its way into the RFCs and into
widely adopted practice. When used as a server variable the word
'referrer' must be spelled incorrectly as 'referer' with one 'r.'
--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET csgallagher@ REMOVETHISTEXT metromilwaukee.com
URL
http://www.metromilwaukee.com/clintongallagher/
"Mark" <pyedubois@hotmail.com> wrote in message
news:#MBgyRgbEHA.216@TK2MSFTNGP10.phx.gbl...[color=blue]
> Thanks.
>
> One problem I'm running into is with my code for this.
>
>
> public void Page_Load(Object sender, EventArgs e){
>
> string urlReferrer;
> urlReferrer = Request.ServerVariables["HTTP_REFERRER"];
>
> 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(urlReferrer);
> }
> }
>
> I get this error:
>
>
> Value cannot be null. Parameter name: url
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about the error and where it originated in the code.
>
> Exception Details: System.ArgumentNullException: Value cannot be null.
> Parameter name: url
>
> Source Error:
>
> Line 14: // and redirect back to default.aspx
> Line 15: Session["ScreenResolution"] =
> Request.QueryString["res"].ToString();
> Line 16: Response.Redirect(urlReferrer);
> Line 17: }
> Line 18: }
>
> Source File: D:\webcontent\hoytASPNET\adds\detectscreen.aspx Line: 16
> "clintonG" <csgallagher@REMOVETHISTEXT@metromilwaukee.com> wrote in message
> news:OkDYYSfbEHA.3096@tk2msftngp13.phx.gbl...[color=green]
> > Detecting a page requested by recalling a Favorite or Bookmark
> > does not populate the Request object which requires an onMouse
> > click event to be populated.
> >
> > A request from a deep link would fire that event, the data would
> > be passed to the Request object in the HTTP_REFERER variable,
> > and the redirect using the Transfer method.
> >
> > I've yet to determine a methodology to reliably detect a request from
> > a Favorite or Bookmark. The only thing to do in that case is fall back
> > to the Request object to determine if the page is being loaded within
> > the domain the page runs within and then use the Transfer method.
> >
> > The very first thing I would try is to capture the requested page and
> > put it into the res variable with the screen properties. When res is
> > passed to detectscreenres.aspx get the page from the QueryString
> > and use it to populate the Transfer method to redirect to the
> > originally requested page.
> >
> > --
> > <%= Clinton Gallagher
> > A/E/C Consulting, Web Design, e-Commerce Software Development
> > Wauwatosa, Milwaukee County, Wisconsin USA
> > NET csgallagher@ REMOVETHISTEXT metromilwaukee.com
> > URL
http://www.metromilwaukee.com/clintongallagher/
> >
> >
> >
> > "Mark" <pyedubois@hotmail.com> wrote in message
> > news:uzwKCzebEHA.1292@TK2MSFTNGP10.phx.gbl...[color=darkred]
> > > 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'[/color][/color]
> is[color=green][color=darkred]
> > > checked for a value. If it has a value, then the page loads with the[/color][/color]
> correct[color=green][color=darkred]
> > > css file for the screen res. If 'screenres' has no value, the user is[/color][/color]
> sent[color=green][color=darkred]
> > > to a page titled 'detectscreenres.aspx' , where the res is disovered via[/color][/color]
> a[color=green][color=darkred]
> > > JavaScript function that passes a value to Session("screenres"). Again,[/color][/color]
> this[color=green][color=darkred]
> > > all works properly.
> > >
> > > The problem I am having is that if a user bookmarks a page, or another[/color][/color]
> site[color=green][color=darkred]
> > > 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[/color][/color]
> Session["ScreenResolution"][color=green][color=darkred]
> > > // 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[/color][/color]
> after[color=green][color=darkred]
> > > visiting 'detectscreenres.aspx'?
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]