Quick Nav:  Online Store   |   Login | Register

Session Values in Text

Rate this topic:

Please Register to post a reply. Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.
AuthorMessages
Rahul Sharma
<20 Posts
Posts:17


01/15/2008 5:08 AM  

Hi John,

I 've got a situation:

Someone comes from a partner to our website with such an URL:

http://www.example.com/Order.aspx?PartnetID=345

We save this PartnerID in Session. We need to add this PartnerID to all the links, to the same domain or outside domains, anywhere on the website.

I tried my luck replacing it in Render event of my HTML/Text control but because of caching it does not work.

Finally I thought to write a global replacement rule for PageBlaster that will be the ideal solution but how can I  add  Session variable's value in the replacement?

This is really urgent for us. Please let me know if PageBlaster can do this or how should I go for this while using PageBlaster caching.

We are a paid version customer of PageBlaster.

Thanks.

 

Rahul

John Mitchell
Posts:3033


01/15/2008 7:13 AM  

Hi Rahul,

PageBlaster doesn't currently have the ability to do replacements using session variables. I could add that ability, but I would recommend against doing what you have outlined.

Here are some reasons why:
You will not be able to cache these pages because they will have to be unique for every user that has that session variable.
Session variables are not good if you have more than one webserver (larger shared hosting companies often use more than one server).

I would add the variable to a cookie on first entry, and then read the cookie whenever you wanted to use it.
Instead of passing it around on the querystring, it would travel with your user "behind the scenes".

If you really need the variables on the querstring (maybe you are chaining across domains), then I will have a new version of PageBlaster out soon that will allow you to create a conditional rule. It could look for the Querystring variable and if it is there, then do replacements on the links. This would work without using a session variable.

You could use that last method I mentioned in the current version, but it would always do the replacement and sometimes the variable would be empty, plus you would not be able to cache the pages.

Your best option is to use the cookie if you can.

Rahul Sharma
<20 Posts
Posts:17


01/15/2008 7:34 AM  

Hi John,

 

Thanks a lot for the quick response.

I do agree with you to avoid Session variables. But as you already stated, problem is with links referring to other domains and the only way I see is to add the variable in querystring of these links.

I can save the variable value in a cookie but how do I add this to all the links on the page?

There are two possible scenario:

1: With the new version of PageBlaster:

Can I create this conditional rule as a Global portal rule?

I will get PartnerID in querystring only on the page where customer is redirected to us from our partner. I can save it in a cookie but will I be able to use cookie value in portal rules to add it to the querystring of links on all other pages too?

How PageBlaster will be able to add this variable at the end of querystring of all the links, referring to another domains, on the portal?

2: I can replace it in my module's Render event but PageBlaster caching does not allow me to do so because when using PageBlaster caching, once the page is cached with PageBlaster, on next request it does not execute the code of my control rather it sends back the cached PageBlaster copy of the page and therefore my code in Render event is not executed. I want caching and PageBlaster is doing perfectly but how should I overcome this problem?

 

Thanks,

 

Rahul

John Mitchell
Posts:3033


01/15/2008 7:58 AM  

The pages will be cached uniquely if they have different Urls.  The complete Url, including the querystring variables are used for the cache key.

So your #2 option should work.

 

For the new version, Yes you could create it as a global rule.  
The ability to use Request variables including Cookies as tokens already exists in the current version.

[RE:Request.Cookies("PartnetID")]

 

John Mitchell
Posts:3033


01/15/2008 9:56 AM  

I just thought of another way you could do this that would give you the best of all performance.

If you store it in a cookie, then you could use a javascript function that seached the page for your links and changed them for you in the user's browser.

This way you could cache normally, and then have the client machine do the work.

Rahul Sharma
<20 Posts
Posts:17


01/17/2008 8:33 AM  
Thanks John,

I'm trying with [RE:Request.Cookies("PartnetID")] but this is simply replacing it with the text and not the cookie value?
I am using PageBlaster 2.2.4. Other tokens like UserInfo tokens are working fine.

Can you pin down?

Thanks.

John Mitchell
Posts:3033


01/18/2008 4:41 PM  

I've been trying to pin it down, and it works in my latest version, but I think you would be much better off to implement what you are trying to do with the javascript method I described.

It's very easy for a javascript routine to loop through all anchor tags in a page and manipulate them in the browser.

Here's an example:

http://www.webmasterworld.com/javascript/3132506.htm

 

Rahul Sharma
<20 Posts
Posts:17


01/30/2008 9:50 AM  

Tons of thanks John, Javascript solution works like a charm :)

Please Register to post a reply. Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.
Forums >Snapsis Product Support >PageBlaster > Session Values in Text



ActiveForums 3.7
Powered by: Snapsis Software