473,396 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Get requsted url?

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'?
Nov 18 '05 #1
3 1082
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" <py*******@hotmail.com> wrote in message
news:uz**************@TK2MSFTNGP10.phx.gbl...
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'?

Nov 18 '05 #2
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@RE************@metromilwaukee.com> wrote in message
news:Ok**************@tk2msftngp13.phx.gbl...
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" <py*******@hotmail.com> wrote in message
news:uz**************@TK2MSFTNGP10.phx.gbl...
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'?


Nov 18 '05 #3
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" <py*******@hotmail.com> wrote in message
news:#M*************@TK2MSFTNGP10.phx.gbl...
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@RE************@metromilwaukee.com> wrote in message
news:Ok**************@tk2msftngp13.phx.gbl...
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" <py*******@hotmail.com> wrote in message
news:uz**************@TK2MSFTNGP10.phx.gbl...
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'?



Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kingdom | last post by:
I have a SelectBoxes.asp page that is working with multiple selection dropdown boxes to extract data and total the selection prices. Tom & Bob were kind enough to give me a big help getting this...
6
by: MLH | last post by:
If I open an A97 table, resort its key-field to descending order and attempt to close the table, A97 asks me if I wish to save the table DESIGN? Now really, I don't think the table design is being...
0
by: Kevin Hodgson | last post by:
I've found samples online (seem to keep finding the same one, about 100 times. ;) Basically I need to cause the default mail app to open a New Mail Message window, with some data filled in, it's...
3
by: Stephen Preston | last post by:
I can't get an $array to be used as a select query on a mySQL database. I have a 'parts list' which displays on a page (works fine) and is a form. At the end of each row is a input type='text'...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.