473,385 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Keeping a login state when moving between http and https

Hi All

I've noticed on quite a few ASP sites that when they have a 'MyAccount'
section they transfer the site to https and then when you have logged into
your account successfully and gone back to the majority of the site you move
back to http whilst still being logged in.

I've used the Session var method before to check if a user can have access
to pages, but how on earth can I keep a handle on this when I flip the user
between my standard http to my https sites (and vice versa) when this
effectively loses the Session var (and cookie values for that matter).

If I have to post certain data between the sites then surely this causes
some kind of security breach.

Would I have to do the following:

1) On https, user enters their login and password.

2) These details are valid so I flag a session var on the https to say that
they can order stuff, look at certain pages, etc.

3) When the user clicks one of the page links back to say a Contact us
(http) page then this link must contain the username and password that they
entered.

4) Now that they are back in the http world, I do another DB query to
validate this details and set a session var in the http.

The above seems very messy for 2 reasons:

1) On the https pages I need to build the username/password into every
single visible link that goes back to the http so that I can trap what the
user is going to click on to go back.

2) The session var timeouts for the http and https are going to be out of
sync because the user might be looking at their account for say 5 mins under
https and then go back to the http.

I'm using 1 x MySQL db for my data, cart and to hold the login info.

If anybody has had this problem before and found a way round it, could you
please give me some pointers.

Thanks

Rob
Jul 19 '05 #1
6 3925
Hi Guys

Any ideas on this??

Rgds

Robbie

"Astra" <in**@NoEmail.com> wrote in message news:40**********@127.0.0.1...
Hi All

I've noticed on quite a few ASP sites that when they have a 'MyAccount'
section they transfer the site to https and then when you have logged into
your account successfully and gone back to the majority of the site you move
back to http whilst still being logged in.

I've used the Session var method before to check if a user can have access
to pages, but how on earth can I keep a handle on this when I flip the user
between my standard http to my https sites (and vice versa) when this
effectively loses the Session var (and cookie values for that matter).

If I have to post certain data between the sites then surely this causes
some kind of security breach.

Would I have to do the following:

1) On https, user enters their login and password.

2) These details are valid so I flag a session var on the https to say that
they can order stuff, look at certain pages, etc.

3) When the user clicks one of the page links back to say a Contact us
(http) page then this link must contain the username and password that they
entered.

4) Now that they are back in the http world, I do another DB query to
validate this details and set a session var in the http.

The above seems very messy for 2 reasons:

1) On the https pages I need to build the username/password into every
single visible link that goes back to the http so that I can trap what the
user is going to click on to go back.

2) The session var timeouts for the http and https are going to be out of
sync because the user might be looking at their account for say 5 mins under
https and then go back to the http.

I'm using 1 x MySQL db for my data, cart and to hold the login info.

If anybody has had this problem before and found a way round it, could you
please give me some pointers.

Thanks

Rob

Jul 19 '05 #2
Astra wrote:

I've noticed on quite a few ASP sites that when they have a
'MyAccount' section they transfer the site to https and then when you
have logged into your account successfully and gone back to the
majority of the site you move back to http whilst still being logged
in.

I've used the Session var method before to check if a user can have
access to pages, but how on earth can I keep a handle on this when I
flip the user between my standard http to my https sites (and vice
versa) when this effectively loses the Session var (and cookie values
for that matter)...


A demonstration is worth a thousand words. Follow this link, keeping in mind
that amazon.com is one such site:
http://www.amazon.com/exec/obidos/tg.../-/0764516507/

Now note that the URL has been appended with a number that looks something
like this: 104-4100512-5185567 (yours will be different). This number is the
session ID for Amazon, and matches the value in amazon.com's "session-id"
cookie. It is passed in both the URL and the cookie as I navigate the site,
including the secured portions of it.

What is the significance of this? For one thing, it suggests a
self-maintained session architecture, and almost certainly one based on a
database. My requests (each click) never identify me. They instead identify
the session**. I am identified on the back end by matching the session to a
record in the database.

Re-writing your site to use homemade sessions might sound like a lot of
work, but the alternative is relying on ASP sessions, which tend to be
unreliable: http://aspfaq.com/show.asp?id=2157

Ultimately, however, abstracting the session data from the web server's
"sessions" is a winning decision. Besides solving the cross-protocol
problem, it enables you to share session data across domains and across
server farms. Heck - it even allows classic ASP and ASP.NET to share session
data. It is a scalable solution.

**There is more going on than just matching the session ID. You can see this
by opening a different browser (such as Mozilla) with the same session URL.
It would not be unreasonable for them to track my IP address and useragent
strings, for example.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #3
How about placing the session ID in a cookie, at the point of login, and
only at the point of login, and then using that as a fixed session ID ?

Something like

'setting the MySessionID
Session("MySessionID") = Session.SessionID

And from then on in only refer to Session("MySessionID") instead of
Session.SessionID, which could change.

Also doing forget to get rid of the cookie at logout, or timeout.

Any good ?
Martin
"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Astra wrote:

I've noticed on quite a few ASP sites that when they have a
'MyAccount' section they transfer the site to https and then when you
have logged into your account successfully and gone back to the
majority of the site you move back to http whilst still being logged
in.

I've used the Session var method before to check if a user can have
access to pages, but how on earth can I keep a handle on this when I
flip the user between my standard http to my https sites (and vice
versa) when this effectively loses the Session var (and cookie values
for that matter)...
A demonstration is worth a thousand words. Follow this link, keeping in

mind that amazon.com is one such site:
http://www.amazon.com/exec/obidos/tg.../-/0764516507/

Now note that the URL has been appended with a number that looks something
like this: 104-4100512-5185567 (yours will be different). This number is the session ID for Amazon, and matches the value in amazon.com's "session-id"
cookie. It is passed in both the URL and the cookie as I navigate the site, including the secured portions of it.

What is the significance of this? For one thing, it suggests a
self-maintained session architecture, and almost certainly one based on a
database. My requests (each click) never identify me. They instead identify the session**. I am identified on the back end by matching the session to a record in the database.

Re-writing your site to use homemade sessions might sound like a lot of
work, but the alternative is relying on ASP sessions, which tend to be
unreliable: http://aspfaq.com/show.asp?id=2157

Ultimately, however, abstracting the session data from the web server's
"sessions" is a winning decision. Besides solving the cross-protocol
problem, it enables you to share session data across domains and across
server farms. Heck - it even allows classic ASP and ASP.NET to share session data. It is a scalable solution.

**There is more going on than just matching the session ID. You can see this by opening a different browser (such as Mozilla) with the same session URL. It would not be unreasonable for them to track my IP address and useragent
strings, for example.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.

Jul 19 '05 #4
Martin Meredith wrote:
How about placing the session ID in a cookie, at the point of login,
and only at the point of login, and then using that as a fixed
session ID ?

Something like

'setting the MySessionID
Session("MySessionID") = Session.SessionID

And from then on in only refer to Session("MySessionID") instead of
Session.SessionID, which could change.

Also doing forget to get rid of the cookie at logout, or timeout.

Any good ?


I don't see where you're using cookies.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #5
Session("MySessionID") = Session.SessionID ???

Or am I doing something wrong - could this be a session variable ? - Am I
getting mixed up - Oh my brain hurts.....

Martin
"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:uR**************@TK2MSFTNGP10.phx.gbl...
Martin Meredith wrote:
How about placing the session ID in a cookie, at the point of login,
and only at the point of login, and then using that as a fixed
session ID ?

Something like

'setting the MySessionID
Session("MySessionID") = Session.SessionID

And from then on in only refer to Session("MySessionID") instead of
Session.SessionID, which could change.

Also doing forget to get rid of the cookie at logout, or timeout.

Any good ?
I don't see where you're using cookies.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.

Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.

Jul 19 '05 #6
Martin Meredith wrote:
I don't see where you're using cookies.


Session("MySessionID") = Session.SessionID ???

Or am I doing something wrong - could this be a session variable ? -
Am I getting mixed up - Oh my brain hurts.....


It most definitely is a session variable, and not a cookie.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #7

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

Similar topics

17
by: Peter Foti | last post by:
If I have a page located at: http://www.mysite.com/mypage.asp And I want to move this to: http://www.mysite.com/mypage/ Which is actually: http://www.mysite.com/mypage/index.asp
2
by: Gill Bates | last post by:
I'm trying to login to a banking site (https://www.providentconnection.com) using vb.net. I've tried many variations of WebClient and HttpWebRequest; none of which I've got to work. My latest...
2
by: Rujuta Gandhi | last post by:
Hi All, I am facing a very crucial problem. Im developing a web application using .net studio 2005(beta). I want my Login.aspx page to be secured(https) for encrypted login information...
0
by: Jacob | last post by:
I would like to provide a login feature on my website that uses HTTPS/SSL. I've gotten all the certificates and have successfully done logins when the login page is secure. But I would prefer to...
7
by: Stimp | last post by:
I have a login page on a Windows IIS server: login.aspx I'd like to enable the user to optionally use HTTPS to login so that their password would not be easily snooped out. What does this...
2
by: patilj | last post by:
OK, here's the deal. Let's say I got a website called: https://www.blah.com/~account/application/login.php When the user arrives they see a https which is more secure than just http alone....
6
by: BizWorld | last post by:
Hi, I have a scenario where i need to configure only Login.aspx page to use SSL. All other application will run on HTTP protocol. If someone can guide me how to accomplish this. One of my idea...
0
by: nfhm2k | last post by:
I've been trying to find a solution to this for quite some time now... I even took a look at existing scripts... Including this one......
8
by: Harris Kosmidhs | last post by:
Hello, while I'm developing sites for some time I never coded a login form with security in mind. I was wondering what guidelines there are. For my point of view I'm thinking of using md5...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.