Reputation: 2298
I have two applications on my webserver.
myserver.com/ApplicationA
myserver.com/ApplicationB
Both applications are using similar codebases and so there are several overlaps in their cookie names, which are causing problems...
I'm aware that it is possible to limit a cookie in ASP.Net so that only applications on a certain "Path" can access it. However, what I'd really like to do this without having to make any code changes to either application.
Is it possible to configuare an ASP.Net application to default to limiting ALL of its cookies to a certain path?
Thanks,
Neil
Upvotes: 3
Views: 187
Reputation: 26956
Sadly the web.configuration httpCookies
element only allows you to set the default domain, and not the path.
You'd need to set the Path
property as you write the cookie, which means that you will need to make some code changes - your best bet would probably be to factor out cookie writing to a shared class, and then use either a value from the web.config or get the application root path to set the property correctly.
Upvotes: 1