NetTalk Central

Author Topic: Should the Webhandler "self" in _TranslateFileName embed be able to see Session?  (Read 2840 times)

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Hi All,

Should the "self" object in Webhandler (which in my understand IS the p_web object), in the _TranslateFileName embed, be able to see Session vars?

At the moment, from my testing, it cannot.

THAT IS:

1. In a form I SSV a value.
2. The user clicks on a link, which I intercept in _TranslateFileName.
3. At this point, I GSV the value .. It is blank.

Any thoughts?
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
>> Should the "self" object in Webhandler (which in my understand IS the p_web object), in the _TranslateFileName embed, be able to see Session vars?

yes. (except if the p_web.SessionId field has not yet been populated.)

>> At the moment, from my testing, it cannot.

you have made a mistake.

cheers
Bruce

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Sure, am always willing to admit that.

1. I set the value, p_web.SSV(), in a form.
2. I click a button with a url in it (the url is within the site).
3. In _TranslateFileName I check the value with self.GSV(), but at this point there is no value.

I've tried using GetSessionValue() instead, and have also tried using Set and Get Value(). To no avail.

I'll try and get an example going.
Cheers,

Stu Andrews

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Boom.

The SessionID field has not been populated.

IE

1. In form, debug p_web.SessionID - GOOD
2. In Webhandler, debug self.SessionID - BLANK

So, I guess my next question is .. Why is it so?

Will do a good site:nettalkcentral.com search, see if it's come up before.
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
possibly TranslateFileName is called before the sessionID is extracted from the incoming request.
So this may be a poor place to change the name based on the session. The best place I would think is the ProcessLink method, before the parent call.

cheers
Bruce

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Would be happy to give that a try .. This code was put here because some wise Capesoft person told me it was the best place to put it.

I'll try ProcessLink, but I know there was some good reasons why the code was in TranslateFileName. Just can't remember what they are at this time.
Cheers,

Stu Andrews

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Bruce,

As per this thread (http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=3892.0;prev_next=next), the p_Filename has the length that it was passed as.

What if I want to change p_FileName to something that is longer than the original length?

EG.

p_FileName as passed:    c:\nettalk\web\awesomecode.pdf

I want to change it to:       c:\nettalk\web\files\pdfs\another.pdf

** At the moment, it obviously chops off whatever is more than the original length.
Cheers,

Stu Andrews

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Got it, can comment out the template call to _SendFile and put my own in.

Thanks to Bill in this post, http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&action=printpage;topic=3793.0.
Cheers,

Stu Andrews