How can I prevent apps from using sessions when a request is made by a bot?

Solution for a project where changing all instances of Session [string] is not an option. My thoughts are implementing the SessionStateStoreProviderBase. I understand that creating a Session class and having properties like Session.UserName would be a good idea.

Edit. The goal is to disable sessions for each user request, not the application, without changing the code on each aspx page.

+2


source to share


2 answers


First, you need a way to tell the bot from a human.

When you're done, think about what you want to achieve.



If you want to disable session for bots, make sure it doesn't break your site. If a search engine bot gets a paginated page, it will index and rank it as such.

+2


source


Set up your robots.txt file to direct (most) bots to the page of your choice, where you have session control and more information. If you want to get free access to all pages, you need to enter a code to distinguish bots from http header information - the research project itself.



+1


source







All Articles