Click here to Skip to main content
14,735,210 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
1)	I have developed an ASP.NET App (non-core) in Visual Studio 2019 using Edge as standard browser. Just a simple app to register and hold items for a local achieve.

2)	Then I move it to the host server that holds a security certificate. www.arkivar.dk
It works with Edge but not with Chrome. The problem with Chrome seems to be with reading ot writing of the cookies. The App only uses technical cookies to remember dropbox selection.

Without these cookies the web app is useless with a Chrome browser!


What I have tried:

3)	To figure out the problem lead me to try and use Chrome as standard I VS. 
It all works here on the localhost. But again moving the app to web Chrome fails to read or write cookies.
The very strange thing is that in this Chrome browser instant, started by VS, it works also on the host server. 
But starting a new Chrome browser instant it is all the same - it is not working!

4)	To visualize the problem I introduced a message on the top bar: Cookies-OK! if it can read the cookies.
5) Not being sure what is happening on the server side, I have tried log actions to a file. But still I am not sure if it is the reading or writing that does not work.

I don’t know what is happening. I don’t even have a clue. 

Please enlighten me or ask for more info.

Regards
Bo Vistisen
Posted
Updated 13-Apr-20 21:17pm
v3
Comments
Richard MacCutchan 21-Mar-20 7:09am
   
It could be a permissions issue. Check the Chrome settings to make sure it has proper access to its configuration folders.

You do realise that Edge and Chrome don't share cookies? That they bost store their own, independent set?

If that's not the problem, you are going to have to show us the relevant code you used to read it - cookies work fine in all browsers, so it's something you have done, not something specific to Chrome

And ... remember: if this is web based and you have any European Union users then GDPR applies and that means you probably need to get the user's permission to store and retrieve them.
   
Comments
Bo Vistisen 21-Mar-20 7:16am
   
Thank you for feed-back.

I only create cookies and write cookies without thinking on the browser that is going to look at the web app. Developing in Visual Studio with Chrome as default browser works fine.

The problem starts when I upload the code to the host. Here Edge works perfect and Chrome does not work at all - with cookies. I don't think there should be anything wrong with the cookies routine code, since they work with Chrome in VS develope environment.

About GDPR I am not certain. I never ask the users permission to cookies at all, because I don't store or save any information of the user. The cookies I keep is for the most navigation cookies for the next .aspx page. Can it be here I am wrong?
In the end of all this, we will proberly find that the error is mine. But where and how.

Can it be a setting in Chrome that makes this difference?
According to your answer it should not be possible to have two sessions of the same browser that acts different.

And still keep in mind that during development locally, with VS2019 and Chrome as default, it works. It is first when it goes to the website that Chrome fails.

Thanks, Bo
OriginalGriff 21-Mar-20 7:24am
   
I would guess that it's your code - specifically that it's using something that works when the server and client are the same machine, but which fails when they are separated - and there are a huge number of things you could have done there, from "trying to use a MessageBox", to "accessing files directly".
C# code runs on the server, so it only has access to server resources - so if your c# code uses "client resources" in any way, your code will work fine in dev,. but fail in prod.

Sorry - but we can't be more specific: we just don't have access to your code or systems.
Bo Vistisen 25-Mar-20 6:53am
   
Again: Thank you OriginalGriff.

I have tried many things this last week because it annoys me that Chrome fails.
I have been in the details and tried simple tests but every test fails with Chrome.
I did find some few issues in my code but nothing that really made a change.

Then I took a different approach. Where does the web app actual work?

The app (www.arkivar.dk) is simple volunteer charity utility app and holds access to five lists:
Journals, Achieves, Artefacts, Photos and Search.
Each list holds at least one dropdown box that uses a cookie for being remembered.
Which browser can change position in the list and keep the selected choices?

On my pc running Windows 10: Edge and Firefox can. Chrome fails!
On my Samsung Android Tablet: Newly installed Edge and Firefox can. Chrome fails!

And then not to forget the strange thing: A Chrome browser instant on my pc, started by MS Visual Studio, works when it is used on the hosted web app.

What can be learned from that? Problems with coding or problems with Chrome?

Thanks, Bo
It took me a long time to find this bug.
It turned out to be the Session_End that was triggered and Session variables was lost.
Having realized that the bug was due to firing Session_End in the middle of the app the bug could not hide!

Sub Session_OnStart()

    ' Administrator will only be allowed a certain number of login attempts
    Session("MaxLoginAttempts") = 3
    Session("LoginCount") = 0

    ' Track whether they're logged in or not
    Session("LoggedIn") = "No"

    Dim intTotal_visitors As Integer
    'set timeout to 20 mins
    Session.Timeout = 1
    Session("Start") = Now

    Application.Lock()
    Application("UseCookies") = "yes"
    Application.UnLock()

    'increase count by 1
    Application.Lock()
    Application("visits") = Application("visits") + 1
    Application.UnLock()
    intTotal_visitors = Application("visits")
    Session("VisitorID") = intTotal_visitors


Session timeout should normaly be 20 min, but for some reason it was set to 1 min.

How stuppid can a programmer be? ME!

Thanks for watching
Bo
   
Comments
Patrice T 14-Apr-20 2:34am
   
If this solves your problem, you can accept your answer, it will close the question.
Sorry for activating the wrong key for comment.
Still no solution found.
Bo
   
v2
Comments
Richard MacCutchan 20-Mar-20 10:38am
   
This is not a Solution. You should use the "Have A Question or Comment" link below the message that you wish to reply to.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900