coldfusion session variable disappearing - session

I have a variable, session.acclevel, which is set during the login process (the program is login2.cfm).
<cfset session.acclevel = logdata['LOGACCESS'][1]>
The values can be N,R,W,A,M, and they are retrieved with query name = "logdata" from a table which I'm calling XXX here. If the login is successful, login2.cfm redirects to program navbar.cfm
<cflocation url = "navbar.cfm?welc=yes">
which is a set of dropdown menus, rather like a dashboard. Depending on the value of session.acclevel navbar shows more or fewer options. The session.acclevel variable is also used throughout the system to control various user activities.
All this was working fine, and then it suddenly stopped working -- session.acclevel was fine when navbar started up, but disappeared as soon as any selection was made. Yet, no code had been changed. The only thing I had changed was to alter the MySql table definition of the acclevel` variable type:
alter table XXX change LogAccess LogAccess enum('A','W','R','N','M');
to add the option 'M' to the enum. I did not chnage any data in that table, and I made no changes to the coding anywhere.
I double checked the timeouts (I am using system admin defaults), and tried without success to trace where the variable was getting lost. I closed and reopened the browser, without fixing anything.
Finally I went to the administrator and changed session management to J2EE -- and that fixed it. session.acclevel is now staying put.
Could someone explain what was going wrong there? I would like to know in case this defect in the ColdFusion session management is caused by weak code that I could avoid, or in case it later breaks under J2EE management.

Related

Oracle APEX 21.2 - What is the use of "Execution Scope" setting under process in the context of Interactive Grids

I am trying to understand the use of the "Execution Scope" setting found under processes of IG Automatic Row Processing as well as validations with IG mapped as editable region.
I kept logging in these process and tried deleting and updating records, but both the settings seems to work the same
Also
With the above code, I deleted a record and it got deleted without raising the validation.
The same when I have the execution scope as "For created and Modified Rows".
Can someone help me understand this setting?
PS: When I set the "Always Execute" this process also gets executed on Delete although the help text for this setting is conveying entirely different explanation.
Thanks
While in Apex, navigate to any property and check help related to it, e.g.
It describes what it is used for, so - I suggest you read it.
Also, almost everything is covered in documentation, e.g. Understanding page processes.

coldfusion session variable not defined

Ive been monitoring the log files of my application recently and its got quite a few references of a certain session variable apparently not existing.
I Know its been defined, as its been part of the application since we built the very first version around 4 or 5 years ago.
So what Im wondering is... if CF throws an error stating that the session variable is undefined. is this an example of a race condition in CF ?
Or is there any other thing that could be causing this generally ?
The session variable is defined when the user logs in as part of their login credentials using a struct containing the users profile information.
At the point of adding an item to the users shopping cart, we must leverage a particular key of this struct to post to a legacy system.
From time to time we see that this variable is not defined. Which is really strange as its definitely there because if it wasnt, the struct that it resides in wouldnt exist.
This application is an application that has been migrated from CF 8 to CF10 and it could be the reason as to the cause of the issue.

Different behaviour for local and productive WeblogicServer

.
Hey guys,
I have a strange behaviour and am wondering why this happens:
My managed bean holds three values (selected plant, selected year and selected month). When opening the required page a #PostConstruct method is called and initializes the plant data according to the selected/pre defined plant, year and month. When changing one of these three options data should be updated and displayed via AJAX request. In order to switch to edit mode I can click my button and change one value from true to fals which is indicating whether the page should be displayed in view or edit mode.
Now here is my problem:
My local Weblogic Server (IntegratedWeblogicServer - standard configuration) works as expected. I open the page, see my current data, switch to edit mode, edit & save it. That's all. Works like a charm.
The productive Weblogic Server (configured by a colleague of mine) does some kind of cache I think. I open the page, see my current data, change year value to last year and see the updated values. When clicking on the "edit" button the old values are displayed instead of the updated values. This just happens as long as I do not switch the plant. My current workaround looks like this: open the page, switch the plant and then switch the year. After switching the plant everything works like expected. I can't figure out why the productive machine behaves different than the local machine. Each of the update methods setPlant(), setYear() and setMonth() call refreshValues() and are equal requading JSF definitions. So I don't know if it's a caching problem or maybe a Weblogic configuration problem.
Let me know if you need more information or certain code snippets. I excluded them as it is a lot of code.
Kind regards,
Stefi
Enable http headers debug from browser and monitor the difference in each environment. Also monitor the access.log on each domains server.

new server/website appears to be caching but cache is turned off

I recently setup a home server running windows 7 pro and IIS 7.5. I have an ASP page that reads/writes to a database. One scenario I have is a newsletter with a list of subscribers. I manually check a box next to a user's name and they get added to a table that associates that userid with a messageid.
When the page loads initially, let's say I've previously added a user to the newsletter. I have a variable that displays that says "1 subscriber". If I add a user (by checking a box next to their name, hitting submit and submitting a form to the same page but with an action=submit added) the user entry will be added to the DB, the script file then redirects to the same page without the action=submit and Session("msg") will show as "updated successfully" but the subscriber count will equal 1 still. If I hit F5, the number updates.
Everything I've read along with what knowledge I have of programming points to it being a caching issue. However, I've taken all the steps I can find online to disable all caching.
Is there something I might be missing or might it not be a caching issue at all but rather something else? I've used this style of programming for years on other servers without any issues which is why I feel like it points to a setting somewhere.
This is the first server, I've been the admin for so I'm kinda bumbling my way through these things as they come up.
subscribers.asp?cid=5
polls DB to pull count of number of subscribers (audience)
[subscribers show 1]
polls DB to pull all email addresses in DB (subscribers)
list available email address within form
I check appropriate checkboxes next to name(s) and submit form
form submits to subscribers.asp?cid=5 with hidden input type name=action value=submit
Script runs (if action=submit then)
insert subscriber ids into audience table
set RS and Conn = Nothing
response.redirect(subscribers.asp?cid=5)
GOTO TOP
subscribers still show as 1. Hit F5, now it shows incremented appropriately.
Any help is greatly appreciated!

Is there a better way than using session variables to access an object anywhere in an application?

I am working with ASP.NET MVC 3.0. I have a page with an action link that makes appear a window in which you can adjust a certain value. Once the new value is sent to the database, an extern application deals with the value and send the result back to that database. I want the action link to be disabled while the extern application is doing her job. The page I am working on is refreshing automatically with some AJAX calls. The date when the extern application finished her last adjustment on a value is kept in the database. I first thought I could use session variables to store the date time of when the action link was pressed (because I need it through all the application) and then enable the action link when the adjust time is greater than the time when the action link was pressed, but I heard it was bad practices. Does someone have another solution?
Since you are already using the database - query the database to check the current status. If your application is restarted - a session value would be lost unless you are using a state server (ie sql server) to manage state- unless you don't care if its lost upon restart. You can use session and save yourself database calls - but the database is a bit cleaner and doesn't suffer from the same issue. If you do end up using the session, don't spread that session value all over your code, simply have a single method that reads or sets it (same with the db solution as well)

Resources