ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 9th, 2008, 06:27 AM
shmerty shmerty is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 69 shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 17 h 34 m 56 sec
Reputation Power: 5
General - Question - Masking QueryStrings;

Hi all,

I gave my website a much needed re-design recently and have tried to make it as accessible as possible.

One feature I have is to allow the user to increase text size by clicking buttons at the top right of the main content. (can be seen here )

Anyways as you can see it just passes a QueryString that then selects what stylesheet to use since its all done with percentages.

The question I have is, can the QueryStrings be masked? Not just for the user but also for search engine spiders as now when I check my Google analytics, index.asp, index.asp?WhatSize=Small, index.asp?WhatSize=Medium... etc etc are all indexed as seperate pages.

Have I gone about this the wrong way? Or is it just one of those things that I just need to accept?

(p.s. I didnt want to use JavaScript to do it because I wanted the website to work on any browser whether JavaScript is disabled or not)

Thanks,
Liam

Reply With Quote
  #2  
Old May 9th, 2008, 07:34 AM
BLarche BLarche is offline
Contributing User
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Jan 2007
Location: Indianapolis, USA
Posts: 3,213 BLarche User rank is Colonel (50000 - 60000 Reputation Level)BLarche User rank is Colonel (50000 - 60000 Reputation Level)BLarche User rank is Colonel (50000 - 60000 Reputation Level)BLarche User rank is Colonel (50000 - 60000 Reputation Level)BLarche User rank is Colonel (50000 - 60000 Reputation Level)BLarche User rank is Colonel (50000 - 60000 Reputation Level)BLarche User rank is Colonel (50000 - 60000 Reputation Level)BLarche User rank is Colonel (50000 - 60000 Reputation Level)BLarche User rank is Colonel (50000 - 60000 Reputation Level)BLarche User rank is Colonel (50000 - 60000 Reputation Level)BLarche User rank is Colonel (50000 - 60000 Reputation Level)BLarche User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Month 5 Days 16 h 56 m 52 sec
Reputation Power: 545
I would not recommend that you pass that through the querystring. Use javascript, not that many people are going to want to change the size of the font anyways.
__________________
"You'll never be as perfect as BLaaaaaaaaarche."

Reply With Quote
  #3  
Old May 9th, 2008, 04:25 PM
shmerty shmerty is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 69 shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 17 h 34 m 56 sec
Reputation Power: 5
Hi thanks again for reply!

I have been playing about tonight and tried another method.

Instead of passing a QueryString from page to page, when you click the buttons to change font size, it goes to an asp only file that then changes a variable in the global.asa file (first time using global.asa believe it or not). The user then gets redirected back to the page from which they clicked and they have the new text size.

I thought I had is sorted!

But then I noticed a problem. The variable is shared between each user. So if one person clicks to have bigger text, everyone else seems to have it to.

Can I stop that?

Reply With Quote
  #4  
Old May 10th, 2008, 08:56 AM
keep_it_simple's Avatar
keep_it_simple keep_it_simple is offline
KIS
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jul 2007
Location: USA
Posts: 1,112 keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 2 h 42 m 20 sec
Reputation Power: 429
Send a message via Yahoo to keep_it_simple
you're at a lose lose situation here....you do not want to use javascript because of on/off issues...yet you are relying on cookies....which too is based on user browser settings....

so...IMO...if you are worried about if a user not having js enabled...then chances are that user knows how to set their own font settings in their browser...(ctrl-mouse scroll) for example...btw...works great on your site...that's a good thing

as far as the current problem...i imagine the word "global" would have set off alarm bells...
__________________
Please give respect to those that helped solve an issue by clicking on the reputation icon

Reply With Quote
  #5  
Old May 12th, 2008, 04:03 AM
shmerty shmerty is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 69 shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 17 h 34 m 56 sec
Reputation Power: 5
Thanks for reply.

Yeah I sort of realised that as well. What's the difference between relying on cookies being enabled or javascript being enabled... The one good thing about using cookies though would be that if the same person came back to my site after months or even years, I would be able to detect what their proffered text size was and display that size of text from the start.

I was going to create a cookie detection and if the user had cookies disabled, then a warning would appear next to the buttons they click to make text bigger/smaller.

Anyways I think I will just use small simple forms and solve the problem that way. No hassle with cookies, and no ugly querystrings.

Thanks for your replies,
Liam

Reply With Quote
  #6  
Old May 12th, 2008, 06:42 AM
shmerty shmerty is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 69 shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 17 h 34 m 56 sec
Reputation Power: 5
I found this website http://www.yha.org.uk/ that manges to do it. They don't Javascript and use cookies like I was trying to.

To change the text size they use a querystring but when you go browsing through website, they querystring is dropped, yet the text size stays your preferred size.

Is there any way to view their global.asa file?

Reply With Quote
  #7  
Old May 12th, 2008, 06:55 AM
sync_or_swim's Avatar
sync_or_swim sync_or_swim is offline
Moderator
Click here for more information.
 
Join Date: Mar 2006
Location: South Wales
Posts: 1,695 sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 15 h 35 m 7 sec
Reputation Power: 1085
Hi,

I may be wrong, but I guess that they achieve this by using session variables. If the page recieves a querystring variable it sets a session variable to the desired text size. Each page then uses the value of this session variable. If you select another text size, the value is passed in the querystring and over-writes the value of the session variable.
Code:
If Len(Trim(Request.Querystring("textsize"))) > 0 Then Session("textsize") = Trim(Request.Querystring("textsize"))

Reply With Quote
  #8  
Old May 12th, 2008, 07:47 AM
shmerty shmerty is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 69 shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 17 h 34 m 56 sec
Reputation Power: 5
HI,

Is the session variable unique to each visitor then? So for instance if a user chooses to have the large text, another user at the other side of world wont have the same large text when he/shee browses the site?

Thats what was happening when I tried using the global.asa file. Im at my work just now so cant remember what the exact code I used was, but it was something like:

Application("TextSize")

But with using that, every user got the same text size.

Thanks,
Liam

Reply With Quote
  #9  
Old May 12th, 2008, 07:51 AM
sync_or_swim's Avatar
sync_or_swim sync_or_swim is offline
Moderator
Click here for more information.
 
Join Date: Mar 2006
Location: South Wales
Posts: 1,695 sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 15 h 35 m 7 sec
Reputation Power: 1085
The session is uinque for each user, check this out:
http://www.w3schools.com/ASP/asp_sessions.asp

Reply With Quote
  #10  
Old May 12th, 2008, 09:32 PM
keep_it_simple's Avatar
keep_it_simple keep_it_simple is offline
KIS
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jul 2007
Location: USA
Posts: 1,112 keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 2 h 42 m 20 sec
Reputation Power: 429
Send a message via Yahoo to keep_it_simple
something to nibble on...not purty,,,but may give you an idea


general cookies...not session

click me
Code:
<%
  Function GetFontSize(sFontSizeSel)
  
   Response.buffer = True 
   
    Select Case sFontSizeSel
     Case "small", "medium","large"
       Response.Cookies("FontSize") = sFontSizeSel
       Response.Cookies("FontSize").Expires = Date + 365 
       GetFontSize = Request.Cookies("FontSize")
     Case Else
       sFontSizeCookie = Request.Cookies("FontSize")
      If Len(sFontSizeCookie) > 0 Then
        GetFontSize = sFontSizeCookie
      Else
        'default
        GetFontSize = "small"
      End If
    End Select

  End Function

  
%>     


<html>
 <head>

   <style type="text/css">

    body {font-size:<%=GetFontSize(Request.QueryString("font-size"))%>;}
    a {color:blue;}
    span.small {font-size:small;}
    span.medium {font-size:medium;}
    span.large {font-size:large;}

   </style>

  </head>
 <body>       
  <a href="?font-size=small"><span class="small">A</span></a>
  <a href="?font-size=medium"><span class="medium">A</span></a>
  <a href="?font-size=large"><span class="large">A</span></a>
 

  <p>This is some text to test font cookie</p>
 
 </body>
</html>

Last edited by keep_it_simple : May 12th, 2008 at 10:03 PM. Reason: link....made as a general cookie vs session...stateful

Reply With Quote
  #11  
Old May 13th, 2008, 05:18 AM
shmerty shmerty is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 69 shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level)shmerty User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 17 h 34 m 56 sec
Reputation Power: 5
Thanks sync_or_swim and keep_it_simple for your help.

I was way over complicating things. For some reason I had it in my head that the only way I was going to get this to work is by doing something in the global.asa file. But that was completely un-true!

Believe it or not I use sessions for log-in areas. And even though I dont have a global.asa file, sessions created when logging in works fine.

So I have did exact same thing now. When you clcik one of those buttons, it changes the Session("TextSize"). All I needed was to create a session on each users computer so they have control over their text size and no one elses.

I cant believe how much of a puzzle I managed to get myself into!

I will add a quick line of code that will pass a querystring back if session was not changed due to cookies being disabled and dispaly a message stating that.

Now I have created this session, I take it it lasts around 20 minutes if there is no actions from the user? To increase that to lets say and hour, I will have to put that in the global.asa file yes?

Code:
Sub Session_OnStart
Session("TextSize").Timeout = 60
End Sub


The cookie way of doing it taht you just gave me keep_it_simple does seem like a better option though as if the user ever did return to the website, he/she would automatically get their preffered text size so I will give that a go tonight.

And from the global.asa file I can also see how many users are on the website at a time? Im joking, I'm not away to get into that just yet

(I have tested it by opening a few different browsers and making sure changing the text size in one doesnt effect the text size in the other and everything seems ok but for some reason I am still paranoid that I'm overlooking something).

Reply With Quote
  #12  
Old May 13th, 2008, 05:50 AM
sync_or_swim's Avatar
sync_or_swim sync_or_swim is offline
Moderator
Click here for more information.
 
Join Date: Mar 2006
Location: South Wales
Posts: 1,695 sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 2nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 15 h 35 m 7 sec
Reputation Power: 1085
Quote:
Originally Posted by shmerty
Now I have created this session, I take it it lasts around 20 minutes if there is no actions from the user? To increase that to lets say and hour, I will have to put that in the global.asa file yes?

You're welcome, glad it helped.

With regards the session timeout, did you check out the link I posted?

You just need to specify the number of minutes to increase the session timeout to, like this:
Code:
<%
Session.Timeout=60
%>

Last edited by sync_or_swim : May 13th, 2008 at 05:52 AM.

Reply With Quote
  #13  
Old May 13th, 2008, 07:14 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,266 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)