garethtnash
asked on
VBScript Help
Hi All,
I'm building a script that runs if a checkbox is checked, however currently it is running regardless of whether the checkbox is checked or not. It also creates secure cookies, from variables, but instead of the variables showing i see the variable names??
Here are the lines of code in question -
When i view the cookies i get sha256(ValuetoHash) and Date
What am i doing wrong?
Thanks
I'm building a script that runs if a checkbox is checked, however currently it is running regardless of whether the checkbox is checked or not. It also creates secure cookies, from variables, but instead of the variables showing i see the variable names??
Here are the lines of code in question -
If NOT IsNull(request("SignInRememberMe")) Then
Dim ValuetoHash
ValuetoHash = arrLogin(1,candlogin) & arrLogin(2,candlogin) & arrLogin(3,candlogin)
Dim HashValue
HashValue = sha256(ValuetoHash)
Response.AddHeader "Set-Cookie", "(""cookie"")(""Authentication"")=sha256(ValuetoHash); path=/; HttpOnly"
Response.AddHeader "Set-Cookie", "(""cookie"")(""LoggedIn"")=Date; path=/; HttpOnly"
Response.Cookies("JobsterUK").Expires = dateAdd("d", 365, Now())
end if
result = 3
end if
When i view the cookies i get sha256(ValuetoHash) and Date
What am i doing wrong?
Thanks
ASKER
Hi Big Monty,
Unfortunately the first part isn't working, now regardless of whether the checkbox is checked or not, the scripts don't run.
The element in the form is
The second part works great, except I'm trying to ensure the cookies remain for 365 days, so the code now looks like
I have created CookieDate further up in the script as
When I run this, with the original opening If statement, the cookies get created, as secure HTTPOnly, with the domain name, but no expiry date -> if i close the browser and reopen the cookies are gone?
Help!
Thanks
Unfortunately the first part isn't working, now regardless of whether the checkbox is checked or not, the scripts don't run.
The element in the form is
<input type="checkbox" name="rememberme" id="SignInRememberMe" value="true" checked="checked" form="SignIn">
The second part works great, except I'm trying to ensure the cookies remain for 365 days, so the code now looks like
Response.AddHeader "Set-Cookie", "(""Domain"")(""Authentication"")= " & HashValue & "; expires=" & CookieDate & "; domain=www.domain.co.uk; path=/; HttpOnly"
Response.AddHeader "Set-Cookie", "(""Domain"")(""LoggedIn"")=" & Date & "; expires=" & CookieDate & "; domain=www. Domain.co.uk; path=/; HttpOnly"
I have created CookieDate further up in the script as
Dim CookieDate
CookieDate = dateAdd("d", 365, Now())
When I run this, with the original opening If statement, the cookies get created, as secure HTTPOnly, with the domain name, but no expiry date -> if i close the browser and reopen the cookies are gone?
Help!
Thanks
ASKER
Update, I've got the opening If statement working now,
But
Is not creating any cookies...
Thanks
But
Response.AddHeader "Set-Cookie", "(""Domain"")(""Authentication"")= " & HashValue & "; expires=" & CookieDate & "; domain=www.domain.co.uk; path=/; HttpOnly"
Response.AddHeader "Set-Cookie", "(""Domain"")(""LoggedIn"")=" & Date & "; expires=" & CookieDate & "; domain=www. Domain.co.uk; path=/; HttpOnly"
Is not creating any cookies...
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you
Open in new window