How can I resolve session loss on ASP hosting?

Procédure

What is a session?

In programming, a session is a group of data stored temporarily on the server side for a specific use by a connected user.

Sessions are generally used to store user identification information, such as a username or user ID, as well as application status information, such as items in an online shopping basket.

Sessions are usually associated with a unique session identifier that is stored on the client side, usually in the form of a cookie, to enable the server to retrieve the appropriate session data for each user request.

How can I solve the problem of sessions on my site?

The problem essentially lies in the elements stored in RAM over time. Once the RAM is saturated, the system launches a reboot that will delete the stored elements and therefore potentially the sessions on your site. This may explain why a visitor may find themselves disconnected while visiting your site.

To avoid this, here is the procedure to follow:

1. Generate a key on Machine Key

To do this, go to the machineKey site and click on the "GENERATE" button.

How can I resolve session loss on ASP hosting?

Then copy the generated code into a corner

How can I resolve session loss on ASP hosting?

2. Configuring the web.config file

Go to the administration of your Plesk from the management of your service on the LWS Panel.

How can I resolve session loss on ASP hosting?

Once in Plesk, select "Websites and domains" from the left-hand menu.

On the page that appears, open the drop-down menu for your domain.

Click on "File manager".

How can I resolve session loss on ASP hosting?

In the file manager, you will arrive at the root of your service where the files for your site are located. Look to see if you have a file called web.config.

How can I resolve session loss on ASP hosting?

If so, we'll edit it, otherwise we'll create it by copying all the code I'll give below.

How can I resolve session loss on ASP hosting?

In this file, the content of which is XML, we will add the following to the section:


    
    

At the level of the third line starting with "<machineKey", replace this entire line with the one you retrieved from Machine Key in step 1.</p> <p> </p> <p>Starting from the base file, which is at the root of your service during delivery, here's the code it would give by adding these few extra lines.</p> <p>If you didn't have the file web.config file, create it by copying all the code without forgetting to modify the part indicated above concerning the code generated by Machine Key</p> <pre> <code class="language-xml"><?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <httpErrors> <remove statusCode="400" /> <error statusCode="400" path="D:\www\jetestuneformuleasp.site\error_docs\bad_request.html" /> <remove statusCode="401" /> <error statusCode="401" path="D:\www\jetestuneformuleasp.site\error_docs\unauthorized.html" /> <remove statusCode="403" /> <error statusCode="403" path="D:\www\jetestuneformuleasp.site\error_docs\forbidden.html" /> <remove statusCode="404" /> <error statusCode="404" path="D:\www\jetestuneformuleasp.site\error_docs\not_found.html" /> <remove statusCode="405" /> <error statusCode="405" path="D:\www\jetestuneformuleasp.site\error_docs\method_not_allowed.html" /> <remove statusCode="406" /> <error statusCode="406" path="D:\www\jetestuneformuleasp.site\error_docs\not_acceptable.html" /> <remove statusCode="407" /> <error statusCode="407" path="D:\www\jetestuneformuleasp.site\error_docs\proxy_authentication_required.html" /> <remove statusCode="412" /> <error statusCode="412" path="D:\www\jetestuneformuleasp.site\error_docs\precondition_failed.html" /> <remove statusCode="414" /> <error statusCode="414" path="D:\www\jetestuneformuleasp.site\error_docs\request-uri_too_long.html" /> <remove statusCode="415" /> <error statusCode="415" path="D:\www\jetestuneformuleasp.site\error_docs\unsupported_media_type.html" /> <remove statusCode="500" /> <error statusCode="500" path="D:\www\jetestuneformuleasp.site\error_docs\internal_server_error.html" /> <remove statusCode="501" /> <error statusCode="501" path="D:\www\jetestuneformuleasp.site\error_docs\not_implemented.html" /> <remove statusCode="502" /> <error statusCode="502" path="D:\www\jetestuneformuleasp.site\error_docs\bad_gateway.html" /> <remove statusCode="503" /> <error statusCode="503" path="D:\www\jetestuneformuleasp.site\error_docs\maintenance.html" /> </httpErrors> <tracing> <traceFailedRequests> <clear /> </traceFailedRequests> </tracing> </system.webServer> <system.web> <compilation tempDirectory="D:\www\jetestuneformuleasp.site\tmp" /> <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" cookieless="false" timeout="20" /> <machineKey decryption="AES" validation="SHA1" decryptionKey="7ucKOvWBqXrsVMBl" validationKey="ZT6ikp0oQdfQT59F" /> </system.web> </configuration></code></pre> <p> </p> <p>Save your file and you're protected from the session problem.</p>

Rate this article :

This article was useful to you ?

Article utileYes

Article non utileNo

Vous souhaitez nous laisser un commentaire concernant cet article ?

Si cela concerne une erreur dans la documentation ou un manque d'informations, n'hésitez pas à nous en faire part depuis le formulaire.

Pour toute question non liée à cette documentation ou problème technique sur l'un de vos services, contactez le support commercial ou le support technique

MerciMerci ! N'hésitez pas à poser des questions sur nos documentations si vous souhaitez plus d'informations et nous aider à les améliorer.


Vous avez noté 0 étoile(s)

Similar articles

1mn reading

How can I access the Plesk panel with LWS hosting?

0mn reading

How do I create a subdomain in Plesk?

0mn reading

How can I access site statistics in Plesk?

3mn reading

CHMOD rights management


Questions sur l'article
jb-info Il y a 480 days
Bonjour, j'ai effectivement un problème avec mes sessions sur mon hébergement pour un site asp.net , j'ai suivis votre article à la lettre cependant lorsque j'y ajoute la balise 'machineKey' j'obtient une erreur 500. Auriez-vous une solution ?
See the
1 answers
Aurelien-LWS - Il y a 479 days

Bonjour, 

Je vous remercie pour votre message. 

Je me suis permis de me connecter à votre formule d'hébergement pour voir la présence de la balise machinekey.

Ne constatant pas la présence de cette balise, j'ai effectué son ajout comme indiqué dans cette documentation sur votre fichier web.config.

Je n'ai pas constaté d'erreur 500 après avoir effectué cet ajout. Aussi, je vous invite à vérifier le bon fonctionnement de votre site et la résolution de votre problème de session.

Il est important lors de l'ajout de cette balise de bien la mettre entre les balises <system.web> et </system.web>

Vous ne devez pas dupliquer ces balises si elles existent déjà dans votre fichier web.config, mais simplement ajouter la balise machinkey entre ces deux balises déjà existante.

La duplication des balises <system.web> peut être la cause de l'erreur 500 que vous avez obtenu en effectuant l'opération.

Cordialement, L'équipe LWS 

Utile ?

Ask the LWS team and its community a question