1

I am trying to set the scope of a cookie for only the default web page on my web application using the HttpCookie.Domain and HttpCookie.Path. The page is named "default.aspx". Problem is, it is set as the default web page so the user goes to "mywebsite.com" in which the path is "/". So the browser does not see the name of the page and therefore doesn't find the cookie if Path is set to "/default.aspx" subsequently.

Is there a trick to get around that or am I stuck with just using a cookie that will be sent back and forth for all pages in the site?

stymie2
  • 101
  • 10
  • do you have try the `HttpCookie.Path="/"` ? – Aristos Feb 08 '20 at 08:45
  • Yes, as far as I know, if I am going to set the Path value, then "/" is the path for the default page when a page is not specified in the URL. If I leave out the Path property then the cookie is available to all pages. Which is the same result as setting the Path to "/". What I would like is the browser to send the cookie only for the default page without having to have the page specifically in the URL. – stymie2 Feb 10 '20 at 15:18

0 Answers0