简体   繁体   English

Tuckey urlrewrite检查是否设置了cookie

[英]Tuckey urlrewrite check if cookie is set

I am trying to check if given cookie exists with given tag in urlrewrite.xml: 我正在尝试检查给定的cookie是否存在于urlrewrite.xml中的给定标签中:

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

but it seams not to work. 但它似乎无法正常工作。

Any ideas? 有任何想法吗?

What I had to do is first check for the existence of the parameter|cookie and then compare to the value I wanted... 我要做的是首先检查参数| cookie的存在,然后与我想要的值进行比较...

<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. 将上面的类型替换为cookie并更改要查找的cookie的名称,您应该可以使用它。 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. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM