473,890 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BASE64 Encoding and don't want to use session variables

Hello again all,

I've finished my whole application and now I don't like the whole
session variables that I am using. I have a form, user fills in info
clicks submit and using CDOSYSMail an email link gets created with an
encoded query string. i.e
http://www.yahoo.ca?#$ @%@&#%#$@&^@%# which translates into
http://www.yahoo.ca?userID=54&LocationID=Denver.

Now when the user get's this email and clicks on the link I have a
decode function(again using BASE64) that takes that url and decodes it
to http://www.yahoo.ca?userID=54&LocationID=Denver. My app then
connects to the database and pulls info associated with that
querystring. I am doing the passing from page to page using session
variables. I do not want to do this? Any ideas How I can take what
is encoded in the url link and decode it on the next page? Let me
know if there is a simple solution to this. I love the encode/decoding
function. Thanks very much.

Right now I have on one page i.e Page1.ASP
Expand|Select|Wrap|Line Numbers
  1. userID = oCmdInfo.Parameters("User_ID").value
  2. LocationID = oCmdInfo.Parameters("Location_ID").value
  3.  
  4.  
  5. SessionUserEncode = base64_encode("UserID=" & userID )
  6. SessionLocationEncode = base64_encode("LocationID =" & LocationID)
  7.  
  8.  
On the receiving page (Pagereceive.as p) I have
Expand|Select|Wrap|Line Numbers
  1. SessionUserDecode = base64_Decode(SessionUserEncode)
  2. SessionLocationDecode = base64_decode(SessionHardwareEncode)
  3.  
This will work if I am the user who does all the inputting of the form
and my browser is still open when I receive the email link and click
on it. If my browser is closed the session get's lost obviously.

Jun 13 '07
12 3857
Anthony Jones wrote:
"MrHelpMe" <cl********@hot mail.comwrote in message
news:11******** **************@ a26g2000pre.goo glegroups.com.. .
>On Jun 14, 10:59 am, "Anthony Jones" <A...@yadayaday ada.comwrote:
>>>:) O.k it probably would have been worth to note that I am not the
most proficient with ASP. You have basically just described what I
need but have no idea how to code that:) You are right, I didn't
need session variables but I have no idea how to pass the data
from page to page except using the request.queryst ring. But if I
use this as well as the encoding, for some reason I can't get it
to decode the URL. Your help would be appreciated just to start me
off Anthony. I have one page that is a form, another page that
receives the form information and inserts into the database and
send an emailed URL. When the user clicks the URL, this is the
page that I have no idea on how to decode the contents of the URL
because I need to pass the encoded values from the last page to
this page. Sorry my explaination is not the best. This is what I
tried to do with session variables
Expand|Select|Wrap|Line Numbers
  1. LastID = oCmdUserInfo.Parameters("User_ID").value
  2. LocationID = oCmdUserInfo.Parameters("Location_ID").value
  3. SessionUserID = base64_encode("UserID=" & LastID)
  4. SessionLocationID = base64_encode("LocationID=" & LocationID)
  5. ----this code will then go on the next page
  6. SessionDecode = base64_Decode(SessionUserID)
  7. SessionLocationDecode = base64_decode(SessionLocationID)

Your probably laughing at me right now:)

Lets put the base64 stuff to one side to make things a bit clearer
(and because it isn't much use).

The key thing here is that you creating a URL that is sent to
another person via email and the querystring portion of the URL
(some times known as the search string) contains 'session data' you
need to transfer.

http://yoursite.com/receivepage.asp?...ationID=Denver

The code in the receivepage needs to do the following:-

SessionUser ID = Request.QuerySt ring("userID")
SessionLocati onID = Request.QuerySt ring("locationI D")- Hide quoted
text -
>>>
- Show quoted text -

O.k I got you on that and that is what I did on the receiving side.
What is next?

That depends on what you want to do next. You've got your values in
to variables I thought that was the only thing you were having
trouble with.

If you want to persist those values for other pages that the
receiving user may visit on your site now you can place them in the
session object:-

Session("UserID ") = SessionUserID
Session("Locati onID") = SessionLocation ID

Then in other pages you can do:-

SessionUserID = Session("UserID ")
SessionLocation ID = Session("Locati onID")
I believe he does not want to send these values in the clear. I think
what he needs is:

SessionUserID = Request.QuerySt ring("userID")
SessionLocation ID = Request.QuerySt ring("locationI D")
SessionUserDeco de = base64_Decode(S essionUserID )
SessionLocation Decode = base64_decode(S essionLocationI D )
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jun 14 '07 #11

"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcomwrote in message
news:u%******** ********@TK2MSF TNGP02.phx.gbl. ..
Anthony Jones wrote:
"MrHelpMe" <cl********@hot mail.comwrote in message
news:11******** **************@ a26g2000pre.goo glegroups.com.. .
On Jun 14, 10:59 am, "Anthony Jones" <A...@yadayaday ada.comwrote:
:) O.k it probably would have been worth to note that I am not the
most proficient with ASP. You have basically just described what I
need but have no idea how to code that:) You are right, I didn't
need session variables but I have no idea how to pass the data
from page to page except using the request.queryst ring. But if I
use this as well as the encoding, for some reason I can't get it
to decode the URL. Your help would be appreciated just to start me
off Anthony. I have one page that is a form, another page that
receives the form information and inserts into the database and
send an emailed URL. When the user clicks the URL, this is the
page that I have no idea on how to decode the contents of the URL
because I need to pass the encoded values from the last page to
this page. Sorry my explaination is not the best. This is what I
tried to do with session variables
Expand|Select|Wrap|Line Numbers
  1. LastID = oCmdUserInfo.Parameters("User_ID").value
  2. LocationID = oCmdUserInfo.Parameters("Location_ID").value
  3. SessionUserID = base64_encode("UserID=" & LastID)
  4. SessionLocationID = base64_encode("LocationID=" & LocationID)
  5. ----this code will then go on the next page
  6. SessionDecode = base64_Decode(SessionUserID)
  7. SessionLocationDecode = base64_decode(SessionLocationID)

Your probably laughing at me right now:)

Lets put the base64 stuff to one side to make things a bit clearer
(and because it isn't much use).

The key thing here is that you creating a URL that is sent to
another person via email and the querystring portion of the URL
(some times known as the search string) contains 'session data' you
need to transfer.

http://yoursite.com/receivepage.asp?...ationID=Denver

The code in the receivepage needs to do the following:-

SessionUserI D = Request.QuerySt ring("userID")
SessionLocatio nID = Request.QuerySt ring("locationI D")- Hide quoted
text -
>>
- Show quoted text -

O.k I got you on that and that is what I did on the receiving side.
What is next?
That depends on what you want to do next. You've got your values in
to variables I thought that was the only thing you were having
trouble with.

If you want to persist those values for other pages that the
receiving user may visit on your site now you can place them in the
session object:-

Session("UserID ") = SessionUserID
Session("Locati onID") = SessionLocation ID

Then in other pages you can do:-

SessionUserID = Session("UserID ")
SessionLocation ID = Session("Locati onID")

I believe he does not want to send these values in the clear. I think
what he needs is:

SessionUserID = Request.QuerySt ring("userID")
SessionLocation ID = Request.QuerySt ring("locationI D")
SessionUserDeco de = base64_Decode(S essionUserID )
SessionLocation Decode = base64_decode(S essionLocationI D )
Base64 is in the clear.

A better mechanism would be to store the UserID and location in a DB table
along with a GUID base unique identifier and a expiry datetime.

Place the GUID in the URL.

The receiving page can then use the GUID retrieve the values. That way the
actual values never leave the server.
The receiving page can delete the GUID record to enable a use once
behaviour.

Jun 15 '07 #12
On Jun 15, 6:03 am, "Anthony Jones" <A...@yadayaday ada.comwrote:
"Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcomwrote in messagenews:u%* *************** @TK2MSFTNGP02.p hx.gbl...


Anthony Jones wrote:
"MrHelpMe" <clintto...@hot mail.comwrote in message
>news:11******* *************** @a26g2000pre.go oglegroups.com. ..
>On Jun 14, 10:59 am, "Anthony Jones" <A...@yadayaday ada.comwrote:
>>>:) O.k it probably would have been worth to note that I am not the
>>>most proficient with ASP. You have basically just described what I
>>>need but have no idea how to code that:) You are right, I didn't
>>>need session variables but I have no idea how to pass the data
>>>from page to page except using the request.queryst ring. But if I
>>>use this as well as the encoding, for some reason I can't get it
>>>to decode the URL. Your help would be appreciated just to start me
>>>off Anthony. I have one page that is a form, another page that
>>>receives the form information and inserts into the database and
>>>send an emailed URL. When the user clicks the URL, this is the
>>>page that I have no idea on how to decode the contents of the URL
>>>because I need to pass the encoded values from the last page to
>>>this page. Sorry my explaination is not the best. This is what I
>>>tried to do with session variables
Expand|Select|Wrap|Line Numbers
  1.  >>>LastID = oCmdUserInfo.Parameters("User_ID").value
  2.  >>>LocationID = oCmdUserInfo.Parameters("Location_ID").value
Expand|Select|Wrap|Line Numbers
  1.         
  2.                         
  3.                  >>>SessionUserID = base64_encode("UserID=" & LastID)
  4.  >>>SessionLocationID = base64_encode("LocationID=" & LocationID)
  •  
  •         
  •                         
  •                  >>>----this code will then go on the next page
  •  >>>SessionDecode = base64_Decode(SessionUserID)
  •  >>>SessionLocationDecode = base64_decode(SessionLocationID)
  •  >>>
  •  
  •  
  • >>>Your probably laughing at me right now:)
    >>Lets put the base64 stuff to one side to make things a bit clearer
    >>(and because it isn't much use).
    >>The key thing here is that you creating a URL that is sent to
    >>another person via email and the querystring portion of the URL
    >>(some times known as the search string) contains 'session data' you
    >>need to transfer.
    >>>http://yoursite.com/receivepage.asp?...ationID=Denver
    >>The code in the receivepage needs to do the following:-
    >>SessionUser ID = Request.QuerySt ring("userID")
    >>SessionLocati onID = Request.QuerySt ring("locationI D")- Hide quoted
    text -
    >>- Show quoted text -
    >O.k I got you on that and that is what I did on the receiving side.
    >What is next?
    That depends on what you want to do next. You've got your values in
    to variables I thought that was the only thing you were having
    trouble with.
    If you want to persist those values for other pages that the
    receiving user may visit on your site now you can place them in the
    session object:-
    Session("UserID ") = SessionUserID
    Session("Locati onID") = SessionLocation ID
    Then in other pages you can do:-
    SessionUserID = Session("UserID ")
    SessionLocation ID = Session("Locati onID")
    I believe he does not want to send these values in the clear. I think
    what he needs is:
    SessionUserID = Request.QuerySt ring("userID")
    SessionLocation ID = Request.QuerySt ring("locationI D")
    SessionUserDeco de = base64_Decode(S essionUserID )
    SessionLocation Decode = base64_decode(S essionLocationI D )

    Base64 is in the clear.

    A better mechanism would be to store the UserID and location in a DB table
    along with a GUID base unique identifier and a expiry datetime.

    Place the GUID in the URL.

    The receiving page can then use the GUID retrieve the values. That way the
    actual values never leave the server.
    The receiving page can delete the GUID record to enable a use once
    behaviour.- Hide quoted text -

    - Show quoted text - Anthony and Bob, thank for the suggestions. I am going to try the
    SessionUserID = Request.QuerySt ring("userID")
    SessionLocation ID = Request.QuerySt ring("locationI D")
    SessionUserDeco de = base64_Decode(S essionUserID )
    SessionLocation Decode = base64_decode(S essionLocationI D )

    If it is not what I need I will try the GUID in the url. Thanks again
    everyone.

    Jun 15 '07 #13

    This thread has been closed and replies have been disabled. Please start a new discussion.

    Similar topics

    5
    26542
    by: Rodney Pont | last post by:
    I've got the example below to set up phpOpenTracker to log exit URL's but I'm having trouble getting it to work. I have played with the quotes and changed the \\2 to $3 and got the url in there but I can't get it to base64 encode it. I'm new to PHP and any help on getting the encoding to work would be appreciated. <?php function encode_exit_urls($buffer) {
    3
    5403
    by: wenmang | last post by:
    Hi, I ma thinking whether to use Base64 encoding to encode the binary content in the XML file. I have done some simple calculations, it seems to me that the size for encoded content increases by ~30%, is this the drawback for using the encoding scheme? Thanks.
    1
    537
    by: mvdevnull | last post by:
    hey all currently i use the following piece of code to check if the string passed to me can be converted to base64, it is not very efficient and bad, can someone please suggest another of doing this private string ConvertBase64ToString(string content) { StringBuilder sb = new StringBuilder(); int i = content.GetUpperBound(0);
    2
    29366
    by: kevin | last post by:
    DISCLAIMER: I know what the words mean (i.e. by definition), but I in know way pretend to understand the specifics of either, therefore I may need a basic primer before I can accomplish this task, but the instructions I received do not seem correct. I need to covert a hex string to base64 and was told to 1. convert from the HEX string to a byte array 2. convert the byte array to Base64 encoding 3. the two encodings would produce the...
    5
    4129
    by: Jay | last post by:
    I have bean trying to get my head around reading .GIF files from base64 strings, Basically I need to specify a filename and convert it to base64 then I can copy/past the string to wear I want it. Cold somebody check this for me to see what I have done wrong: If you run this program and enter a path for a .GIF file into the white box and hit <Enter> it should display the string in the blue box. To test this if you click the menu File...
    9
    9752
    by: Jeremy Kitchen | last post by:
    Are there any library functions that can help me to do this? If necessary I can convert the string to a byte array. I don't want to have to write my own Hex conversion if it isn't necessary. Thanks for any help Jeremy Kitchen
    8
    2816
    by: Jeremy Kitchen | last post by:
    I have encoded a string into Base64 for the purpose of encryption. I then later decrypted it and converted it back from Base64 the final string returns with four nothing characters. "pass" what the result should be "pass____ what the result is where each underline char is a nothing char. I am about to write a function that will remove the nothing chars butI would like to know what is causing the problem and simply avoid it
    10
    4066
    by: pycraze | last post by:
    Hi , I am currently trying to implement base64 encoding and decoding scheme in C . Python has a module , base64 , that will do the encoding and decoding with ease . I am aware of OpenSSL having support for base64 encoding and decoding , but i will have to now implement both in C without using the openssl libraries . I was able to download a code w.r.t. base 64 encoding and decoding . I am attaching the code below .
    1
    6866
    by: maxxxxel | last post by:
    Hi Can anyone help me with some asp code , I changed the code to use CDO.message instead of the old cdont.sys to send mail from a ASP webpage which works fine. Our problem is that when we send mail externally to a internet email site like Gmail the PDF is sent but is corrupted because CDOSYS ends up using binary encoding rather than Base64 encoding when creating the attachment. More information here: Anthonys Code My knowledge of ASP...
    0
    9976
    marktang
    by: marktang | last post by:
    ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
    0
    9815
    by: Hystou | last post by:
    Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
    0
    11215
    Oralloy
    by: Oralloy | last post by:
    Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
    0
    10802
    jinu1996
    by: jinu1996 | last post by:
    In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
    1
    10908
    by: Hystou | last post by:
    Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
    0
    9618
    agi2029
    by: agi2029 | last post by:
    Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
    1
    8008
    isladogs
    by: isladogs | last post by:
    The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
    0
    6035
    by: adsilva | last post by:
    A Windows Forms form does not have the event Unload, like VB6. What one acts like?
    2
    4259
    muto222
    by: muto222 | last post by:
    How can i add a mobile payment intergratation into php mysql website.

    By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

    To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.