0

I am trying to create a check cookie server side script that will work in both Classic ASP pages and VB.NET pages. I have been unsuccessful. Example below:

<% If Request.Cookies("login-id") = "" Then Response.Redirect("login.asp") %>

This works on my Classic ASP pages, but in .NET, it throws an error because when there is no cookie, it throws an exception because it can't read a cookie that doesn't exist.

Is there a way for me to craft the script in a way that would work in both Classic and VB.NET?

  • Does this answer your question? [Sharing login-system between classic ASP and ASP.Net](https://stackoverflow.com/a/921575) – user692942 Jun 01 '20 at 15:13
  • This is not a duplicate of my question. I do not want to share cookies across different domains. It's all on same domain. – codewelldesign Jun 02 '20 at 19:08
  • The principles are the same regardless you want to share a cookie between applications. As you didn’t make it clear that the sites weren’t cross domain, what do you expect? – user692942 Jun 02 '20 at 21:44
  • I can set a cookie on Classic ASP and read it in .NET applications and vice versa with no issues. So I'm not sure why this wasn't work. – codewelldesign Jun 02 '20 at 23:16

0 Answers0