Tuckey urlrewrite check if cookie is set

1.5k Views Asked by At

I am trying to check if given cookie exists with given tag in urlrewrite.xml:

<condition type="cookie" name="LANGUAGE" operator="notequals"></condition>

but it seams not to work.

Any ideas?

1

There are 1 best solutions below

0
On

What I had to do is first check for the existence of the parameter|cookie and then compare to the value I wanted...

<rule>
    <condition type="parameter" name="theme" operator="equal">^.+$</condition>
    <condition type="parameter" name="theme" operator="notequal">^default$</condition>
    <set name="themeheader">Theme is %{parameter:theme}</set>
</rule>

Replace type above with cookie and change the name of the cookie you want to find and you should be able to use this. I have tested this and I'm now using this on my server so I know it does what I'd expect.

Hope it helps.