Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Session Variable no longer found

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Session Variable no longer found

    Hi-
    I'm moving along with my first A5 app, following Steve Workings videos on log-in and session variables. So I have it working, the user logs in and I have a top where the company name and user fullname is displayed as well as a log out link. So all this works and I'm off to start on the first filtered component but come back to test it by logging and now it will not "see" my session variables and produces an error. My intermediate process code is below.

    <%a5

    dim session.CompanyID as N=0 'set to zero so there cannot be a company primary key with this value.
    dim session.SubCompanyID as N=0 'also set to zero
    dim session.IsLogixLink as L=.f. 'if the user is from LogixLink, show all data.
    dim session.IsLicenseOwner as L=.f. 'if the user does not own the software, make sure they only see their data
    dim session.CompanyName as C="" 'to display the company name.
    dim session.FullName as C="" 'to display the user's name.
    dim session.User as C=""
    'Get the Company ID of the current user.
    dim GetCurrentUser as C

    GetCurrentUser=a5ws_getcurrentuser()
    if GetCurrentUser<>"" 'This should never happen at this point.
    session.user=a5ws_getcurrentuser()
    dim args as sql::Arguments
    args.Set("Username",GetCurrentUser)

    'Get the Company ID for use throughout program to display proper inventory.
    session.CompanyID=sql_lookup("::name::LogixDBLink","LicenseOwners","UserName=:UserName","LicenseOwners_PK",args)

    'Get the name of the company for display purposes.
    session.CompanyName=sql_lookup("::name::LogixDBLink","LicenseOwners","UserName=:UserName","CompanyName",args)

    'Get the full name of the user for display purposes.
    session.FullName=sql_lookup("::name::LogixDBLink","LicenseOwners","UserName=:UserName","FullName",args)


    end if
    response.redirect("Index.a5w")
    %>

    The code in my "page top" looks like this:
    <%a5
    If a5ws_getcurrentuser() <> ""
    ?"Company Name: "+session.CompanyName+" User: "+session.FullName+" <a href=\"Logout.a5w\">(Logout)</a>"
    end if
    %>

    The error that shows up if I hit the "back" button on the browser is:
    Script Error
    Error:Script:PageTop.a5w line:44
    ?"Company name is :"+session.CompanyName+"<a href=\"Logout.a5w\">(Logout)</a>"
    Property not found
    session.CompanyName subelement not found

    This is on my developement laptop obviously. Any ideas where I start to track this down. As I said, it worked and I don't think I did anything else to make it stop working. I moved on to creating a simple grid based on a session id. That did not work and that made me go back and look at the log in.

    Thanks

    #2
    Re: Session Variable no longer found.

    Probably your session timed out while you were building the grid. Default is 15 minutes unless you change it. If on laptop, see Web > Application Server and then the Sessions tab to increase it. But also, having the session time out should never be allowed to cause a problem like this. Your code should regenerate the session variable if needed.

    The code below can cause a problem because a user being logged in does not mean the session has or has not timed out. Said differently, a5ws_getcurrentuser() can return a value (meaning someone is logged in) but the session may have already timed out.

    If a5ws_getcurrentuser() <> ""
    ?"Company Name: "+session.CompanyName+" User: "+session.FullName+" <a href=\"Logout.a5w\">(Logout)</a>"
    end if
    Steve Wood
    See my profile on IADN

    Comment


      #3
      Re: Session Variable no longer found.

      Thanks Steve,
      The session timeout is set to 45 minutes and I have recreated the same problem with "test" pages and have been working on it for two days now trying to track it down. The really nasty thing is that it worked for a day just fine. How do you debug something that works and then suddenly doesn't? It has to be some change but I have recreated with clean slate pages and the same problem occurs. I can load the page fine without session variables but when you try to load and use the variables, it doesn't work.



      Originally posted by Steve Wood View Post
      Probably your session timed out while you were building the grid. Default is 15 minutes unless you change it. If on laptop, see Web > Application Server and then the Sessions tab to increase it. But also, having the session time out should never be allowed to cause a problem like this. Your code should regenerate the session variable if needed.

      The code below can cause a problem because a user being logged in does not mean the session has or has not timed out. Said differently, a5ws_getcurrentuser() can return a value (meaning someone is logged in) but the session may have already timed out.

      Comment


        #4
        Re: Session Variable no longer found.

        Are you deleting or republishing anything out of the webroot while your session is active? What browser and version are you working with? Does the same problem happen in another browser? Are you accepting cookies?

        Comment


          #5
          Re: Session Variable no longer found.

          Jeremy-
          I'm use IE8 and I have tried it in Google Chrome with the same result. Both browsers return with "session.CompanyName subelement not found". I have gone so far as to clear all publishing history and then re-published everything in the project. I can eliminate the variables and put something like the current user and it willl load fine and display that along with the logout page. I have added, removed, attempted to give the variable a hard coded value, whatever to see if it would load and it won't. As I said before, it worked initially just fine and I moved on to something else so I'm at a loss.

          Originally posted by jthornton View Post
          Are you deleting or republishing anything out of the webroot while your session is active? What browser and version are you working with? Does the same problem happen in another browser? Are you accepting cookies?

          Comment


            #6
            Re: Session Variable no longer found.

            When you first login does it set the session variable and show it on the page? Once you have done that and you refresh the screen what happens? Do you have any script that you have added since you started that is running and might be clearing any of your session variables?

            Comment


              #7
              Re: Session Variable no longer found.

              Try dropping the... If a5ws_getcurrentuser() <> "" .. part of the script on your page top.

              Try this to see if it holds.

              <%a5
              ? "Company Name: "+ session.CompanyName +" User: "+ session.FullName + %> then add your logout html link here.

              Let me know if that works.

              Comment


                #8
                Re: Session Variable no longer found.

                Jeremy-
                No, it does not set the session variable. As soon as it goes to my processing page, it returns the error. I have not added anything else to it. Right now, I just return to the index page. Later on, I'll redirect to a page based on the user. For now though, it just appears that it will not "see" my variables. As I said, it was working and I did not change anything after it began working that I know of.


                Originally posted by jthornton View Post
                When you first login does it set the session variable and show it on the page? Once you have done that and you refresh the screen what happens? Do you have any script that you have added since you started that is running and might be clearing any of your session variables?

                Comment


                  #9
                  Re: Session Variable no longer found.

                  I'm still not getting this to work. I believe it is some lack of understanding regarding the session time. I have now spent two days on it and really need to move along. To make sure other things worked I created some test pages and hardcoded the "current user" value. My lookup's worked fine and the session variables were set properly and were read correctly on a page redirect including a grid set to filter on a session variable. All that works unless you actually 'log' a person in. Then the variable cannot be found according to the error script on the page. The AS session was orignally set to to 45 minutes. I have tried resetting it to 1 minute, logging out and logging back in. That does not work.
                  So, do I need to "close" a session on logout? If so, I tried "session.reset()". That did not work.
                  I have tried changing the security settings on my pages and compenents and that did not make a difference. I currently have them set for "allways allow" for developement purposes but did change them to "login required" to see if that helped and it did not.
                  Not that I have much wit but I'm at it's end. If anyone can point me in a direction I would apprecieate it.

                  Comment


                    #10
                    Re: Session Variable no longer found

                    I suggest create a short video showing all of the details, code and operation where it fails. Seeing how it works/fails will help. Or if that fails, I offer to remote into your application and debug it. It is likely something simple.
                    Steve Wood
                    See my profile on IADN

                    Comment


                      #11
                      Re: Session Variable no longer found

                      Well after a couple more hours here is what it LOOKs like. It looks like when you log in, the security re-direct never re-directs. No matter what page I put into the redirect after login, the page it comes back to is the index page (login). So it never runs my code in the intermediate page. I have enabled security and published the security files (multiple times). Have you ever seen that type of problem before?

                      Thanks


                      Originally posted by Steve Wood View Post
                      I suggest create a short video showing all of the details, code and operation where it fails. Seeing how it works/fails will help. Or if that fails, I offer to remote into your application and debug it. It is likely something simple.

                      Comment


                        #12
                        Re: Session Variable no longer found

                        It all depends on how you prorammed it, why a video will help. Also, it might skip your intermediate page if you initially target a specific page other than your home page. For instance, if your URL tried to open a secure page, and it kicks you back to Login, then you login - it will go immediately to the originally page targeted in the URL, and will skip any redirection to your intermedate page. Easy to spot if you look at the URL when it hits the Login page, it will have an np=xyz in the URL.
                        Steve Wood
                        See my profile on IADN

                        Comment


                          #13
                          Re: Session Variable no longer found

                          This is from the Index page where I'm starting with my login component. I've only added the "top page" lines into this.

                          <!doctype html>
                          <html>
                          <head>

                          <%a5
                          'The componentAlias MUST be UNIQUE for each component on the page. It must not have spaces in the name. Keep name as short as possible
                          dim componentAlias as c
                          componentAlias = "LOGINFORM"
                          Delete tmpl_LOGINFORM
                          DIM tmpl_LOGINFORM as P
                          tmpl_LOGINFORM = a5w_load_component("LoginForm") 'SYSTEM GENERATED COMMENT - PLEASE DO NOT REMOVE (LOAD:LoginForm)
                          'Following code allows you to override settings in the saved component, and specify the component alias (componentName property).
                          'Tip: Keep the componentName property short because this name is used in page URLs, and it will help keep the URLs short.
                          'Each component on a page must have a unique alias (componentName property).
                          with tmpl_LOGINFORM
                          componentName = "LOGINFORM"
                          end with
                          '=======================================compute the HTML for the Component=======================================
                          delete x_LOGINFORM
                          dim x_LOGINFORM as p
                          x_LOGINFORM = a5w_run_Component(tmpl_LOGINFORM) 'SYSTEM GENERATED COMMENT - PLEASE DO NOT REMOVE (RUN:tmpl_LOGINFORM) (EDIT:LoginForm)
                          '=============================================================================================================
                          if x_LOGINFORM.RedirectURL <> "" then
                          response.redirect(x_LOGINFORM.redirectURL)
                          end
                          end if
                          ?x_LOGINFORM.Output.Head.JavaScript
                          ?x_LOGINFORM.Output.Head.CSS_Link
                          %>
                          <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
                          <!--CSS for tmpl_LOGINFORM -->
                          <link rel="stylesheet" type="text/css" href="file:///C:/Program Files (x86)/a5V11/css/MobBlue/style.css">
                          <!--Alpha Five Temporary Code End -->

                          <%a5
                          a5w_include("PageTop.a5w")
                          %>
                          <meta name="generator" content="Alpha Five HTML Editor Version 11 Build 2765-3967">
                          <!-- must use in order to make XP Themes render -->
                          <meta HTTP-EQUIV="MSThemeCompatible" content="Yes" />
                          <meta http-equiv="X-UA-Compatible" content="IE=edge" />
                          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

                          <title></title>
                          </head>
                          <%a5 ?x_LOGINFORM.Output.Body.Body_Tag %>
                          <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
                          <!--Body Tag for tmpl_LOGINFORM -->
                          <body class="MobBluePage"><!--Alpha Five Temporary Code End -->

                          <p><font size=4>LogixLink Warehouse Orders Management
                          System</font></p>
                          <p><br>
                          <table>
                          <tr>
                          <td><%A5 ?x_LOGINFORM.Output.Body.Login_Errors %></td>
                          </tr>
                          <tr>
                          <td><%A5 ?x_LOGINFORM.Output.Body.Login_HTML %></td>
                          </tr>
                          </table></p>
                          </body></html>


                          Originally posted by Steve Wood View Post
                          It all depends on how you prorammed it, why a video will help. Also, it might skip your intermediate page if you initially target a specific page other than your home page. For instance, if your URL tried to open a secure page, and it kicks you back to Login, then you login - it will go immediately to the originally page targeted in the URL, and will skip any redirection to your intermedate page. Easy to spot if you look at the URL when it hits the Login page, it will have an np=xyz in the URL.

                          Comment


                            #14
                            Re: Session Variable no longer found

                            This is the 'top page'. There are several lines which are commented out as I'm testing. It will show up fine with just the 'log out' line.

                            <!doctype html>
                            <html>
                            <head>

                            <%a5
                            'The componentAlias MUST be UNIQUE for each component on the page. It must not have spaces in the name. Keep name as short as possible
                            dim componentAlias as c
                            componentAlias = "NAVIGATIONTOP"
                            Delete tmpl_NAVIGATIONTOP
                            DIM tmpl_NAVIGATIONTOP as P
                            tmpl_NAVIGATIONTOP = a5w_load_component("NavigationTop") 'SYSTEM GENERATED COMMENT - PLEASE DO NOT REMOVE (LOAD:NavigationTop)
                            'Following code allows you to override settings in the saved component, and specify the component alias (componentName property).
                            'Each component on a page must have a unique alias (componentName property).
                            with tmpl_NAVIGATIONTOP
                            location = ""
                            componentName = "NAVIGATIONTOP"
                            end with
                            delete x_NAVIGATIONTOP
                            dim x_NAVIGATIONTOP as p
                            x_NAVIGATIONTOP = a5w_run_Component(tmpl_NAVIGATIONTOP) 'SYSTEM GENERATED COMMENT - PLEASE DO NOT REMOVE (RUN:tmpl_NAVIGATIONTOP) (EDIT:NavigationTop)
                            ?x_NAVIGATIONTOP.Output.Head.JavaScript
                            ?x_NAVIGATIONTOP.Output.Head.CSS_Link
                            %>
                            <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
                            <!--CSS for tmpl_NAVIGATIONTOP -->
                            <link rel="stylesheet" type="text/css" href="file:///C:/Program Files (x86)/a5V11/css/MobBlue/style.css">
                            <link rel="stylesheet" type="text/css" href="file:///C:/Program Files (x86)/a5V11/css/MobBlue/components/a5navsysToolbar/style.css">
                            <!--Alpha Five Temporary Code End -->

                            <meta name="generator" content="Alpha Five HTML Editor Version 11 Build 2765-3967">
                            <!-- must use in order to make XP Themes render -->
                            <meta HTTP-EQUIV="MSThemeCompatible" content="Yes" />
                            <meta http-equiv="X-UA-Compatible" content="IE=edge" />
                            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

                            <title></title>
                            </head>
                            <%a5 ?x_NAVIGATIONTOP.Output.Body.Body_Tag %>
                            <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
                            <!--Body Tag for tmpl_NAVIGATIONTOP -->
                            <body class="MobBluePage"><!--Alpha Five Temporary Code End -->

                            <%a5
                            If a5ws_getcurrentuser() <> ""
                            '?"Company name is :"+session.CompanyName+"<a href=\"Logout.a5w\">(Logout)</a>"
                            ?"<a href=\"Logout.a5w\">(Logout)</a>"
                            '?a5ws_getcurrentuser()+" <a href=\"Logout.a5w\">(Logout)</a>"
                            '?"Current User : "+a5ws_getcurrentuser()+" <a href=\"Logout.a5w\">(Logout)</a>"
                            '?"Company Name: "+session.CompanyName+" User: "+session.FullName+" <a href=\"Logout.a5w\">(Logout)</a>"
                            '?"Company Name is "+"<a href=\"logout.a5w\">(Logout)</a>"+"<a href=\"Login_Process\">(Run Process)</a>"
                            end if
                            %>

                            <table>
                            <tr>
                            <td><!-- Navigation System -->
                            <%a5 ?x_NAVIGATIONTOP.Output.Body.navsysTBH %>
                            </td>
                            </tr>
                            <tr>
                            <td>
                            &nbsp;
                            </td>
                            </tr>
                            </table>


                            </body></html>

                            Comment


                              #15
                              Re: Session Variable no longer found

                              Hi

                              I was under the impression that session variables could only be c type, not n or logical ?

                              Robin

                              Comment

                              Working...
                              X