Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Cookies are not being written

$
0
0
Cookies are not being written
Web Connection 5.0
Cookies are not being written
Feb. 25, 2013
06:18 am
3Q30DIRTUShow this entire thread in new window
Gratar Image based on email address
From:Paul Mrozowski
To:All
I'm working through some code that works in previous versions of Web Connect (WC55) but doesn't seem to work in the latest version. The code has hooked up a custom user security class for authentication. What I'm seeing is that the code checks to see if they're authenticated, they aren't so it displays the login form. After post back, they are successfully authenticated and the page is displayed. However, if I refresh the page it asks to login again.

Here's the base process class being used:

DEFINECLASS mcgBaseProcess AS wwProcess cAuthenticationMode = "UserSecurity" cAuthenticationUserSecurityClass = "mcgUserSecurity"*lEnableSessionState = .T.* Make sure a user is authenticated before continuingFUNCTION OnProcessInit()IF !This.Authenticate() && If they're not, a login form should appearRETURNENDIFDODEFAULT()ENDFUNCFUNCTION OnAuthenticateUser(tcUserName, tcPassword, tcErrorMsg)This.oUserSecurity = CREATEOBJECT(This.cAuthenticationUserSecurityClass)IF !This.oUserSecurity.Authenticate(m.tcUserName, m.tcPassword)*** Set lcErrorMsg to pass back via REF parm tcErrorMsg = this.oUserSecurity.cErrorMsgIF"expired" $ m.lcErrorMessage* TODO: Response.Redirect(Server.oConfig.cRedirectSignupTo)ENDIFRETURN .F.ELSEENDIFRETURN .T.ENDFUNCENDDEFINE

The mcgUserSecurity is basically just a subclass of wwUserSecurity that uses a different table, but otherwise is the same. This code seems to work as expected.

The Process class (subclassed from mcgBaseProcess) has a function that does the following:

Response.Write("Test2.wcs")

What it appears is happening is that the ContentTypeHeader gets set to "NONE" so that wwScripting is supposed to handle that kind of thing. When wwPageResponse.RenderHttpHeader() is called, since content type is "NONE" it immediately returns (and never reaches the code to write the cookies).

When I compared the old version to the new version, this code had been removed from wwPageResponse.ExpandScript() which means between this and RenderHttpHeader() just returning the new cookie never gets written:

** Keep reference to the 'real' Response object *** Now override the Response object so we can apply headers and cookiesPRIVATE Response Response = loScript.CreateResponse() Response.cStyleSheet = this.cStyleSheet*** WWAPGERESPONSE SPECIFIC CODEIFVARTYPE(tvContentType) != "L" Response.ContentTypeHeader( tvContentType )ELSE*** Copy headers and cookiesFOR lnX = 1 TOTHIS.Headers.Count Response.AppendHeader(this.Headers.GetKey(lnX),THIS.Headers.aItems[lnX,2])ENDFORFOR lnX = 1 TOTHIS.Cookies.Count Response.AppendHeader("Set-Cookie",this.Cookies.aItems[lnX,2])ENDFORENDIF

Does the header now have to be explicitly written out from the WCS script?



Viewing all articles
Browse latest Browse all 10393

Trending Articles