Search code examples
cookiesasp-classic

Prevent Classic ASP from encoding special characters in cookies


As a stop-gap, we are using CloudFlare to handle mobile redirection for a number of our much older sites that are still running Classic ASP. In order to bypass mobile redirection for pages which we don't have a mobile version of, CloudFlare requires we set the following cookie:

__cf_mob_redir

The issue here is that Classic ASP is turning that into this:

%5F%5Fcf%5Fmob%5Fredir

Which if we controlled the reading of the cookie wouldn't matter, but we don't, so it's an issue.

My question is: How can I set a cookie value that includes an underscore in classic ASP?


Solution

  • EDIT

    This pure ASP only line worked for me.

    Response.AddHeader "Set-Cookie", "__cf_mob_redir=__cf_mob_redir; HttpOnly"
    

    Ignore previous answer.