WebRequest不包含CookieContainer的定义

时间:2018-08-28 22:57:37

标签: c# wpf

我试图让我的服务器设置cookie,但是由于某种原因,我的WebRequest不包含CookieContainer的定义。在互联网上找不到任何人遇到相同的问题:

    <select class="xyz" id="vadults" name="vadults">
       <option value="0" disabled selected> Number of Adults</option>
       <option value="1">1</option>
       <option value="2">2</option>
       <option value="3">3</option>
       <option value="4">4</option>
       <option value="5">5</option>
       <option value="6">6</option>
    </select>

    <select class="xyz" id="vchilds" name="vchilds">
        <option value="0" disabled selected>Number of Childs</option>
        <option value="0">No</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
       <option value="5">5</option>
       <option value="6">6</option>
   </select>

    <select class="xyz" id="vbeds" name="vbeds">
         <option value="0" disabled selected>Type of Bed</option>
         <option value="1">Single</option>
         <option value="2">Double</option>
    </select>

    <select class="" id="vrooms" name="vrooms">
      <option value="0" disabled selected>Required number of Rooms</option>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
       <option value="5">5</option>
       <option value="6">6</option>
       <option value="7">7</option>
       <option value="8">8</option>
    </select>



    $('.xyz').change(function () {
                    var adults = $("#vadults option:selected").val();
                    var childs = $("#vchilds option:selected").val();
                    var beds = $("#vbeds option:selected").val();
                    var rooms = $("#vrooms option:selected").val();
                    if (beds == 1) {
                        if (adults == 1) {
                            $("#vrooms option[value='1']").removeAttr('disabled');
                            $("#vrooms option[value='2']").removeAttr('disabled');
                            $("#vrooms option[value='3']").removeAttr('disabled');
                            if (childs == 1) {
                                $("#vrooms option[value='1']").removeAttr('disabled');
                                $("#vrooms option[value='2']").removeAttr('disabled');
                                $("#vrooms option[value='3']").removeAttr('disabled');
                            }
                            if (childs == 3 || childs == 2) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('selected', 'selected');
                                $("#vrooms option[value='2']").removeAttr('disabled');
                                $("#vrooms option[value='3']").removeAttr('disabled');
                            }
                            if (childs == 4 || childs == 5) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('selected', 'selected');
                                $("#vrooms option[value='3']").removeAttr('disabled');
                            }
                            if (childs == 6) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('disabled', 'disabled');
                                $("#vrooms option[value='4']").attr('selected', 'selected');
                            }
                        }
                        if (adults == 2) {
                            $("#vrooms option[value='1']").attr('disabled', 'disabled');
                            $("#vrooms option[value='2']").attr('selected', 'selected');
                            $("#vrooms option[value='2']").removeAttr('disabled');
                            $("#vrooms option[value='3']").removeAttr('disabled');
                            if (childs == 1 || childs == 2) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('selected', 'selected');
                                $("#vrooms option[value='2']").removeAttr('disabled');
                            }
                            if (childs == 3 || childs == 4) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('selected', 'selected');
                                $("#vrooms option[value='3']").removeAttr('disabled');
                            }
                            if (childs == 5 || childs == 6) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('disabled', 'disabled');
                                $("#vrooms option[value='4']").attr('selected', 'selected');
                            }
                        }
                        if (adults == 3) {
                            $("#vrooms option[value='1']").attr('disabled', 'disabled');
                            $("#vrooms option[value='2']").attr('disabled', 'disabled');
                            $("#vrooms option[value='3']").attr('selected', 'selected');
                            $("#vrooms option[value='3']").removeAttr('disabled');
                            if (childs == 1 || childs == 2 || childs == 3) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('selected', 'selected');
                                $("#vrooms option[value='3']").removeAttr('disabled');
                            }
                            if (childs == 4 || childs == 5 || childs == 6) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('disabled', 'disabled');
                                $("#vrooms option[value='4']").attr('selected', 'selected');
                            }
                        }
                        if (adults == 4) {
                            $("#vrooms option[value='1']").attr('disabled', 'disabled');
                            $("#vrooms option[value='2']").attr('disabled', 'disabled');
                            $("#vrooms option[value='3']").attr('disabled', 'disabled');
                            $("#vrooms option[value='4']").attr('selected', 'selected');
                            $("#vrooms option[value='4']").removeAttr('disabled');
                            if (childs == 1 || childs == 2 || childs == 3 || childs == 4) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('disabled', 'disabled');
                                $("#vrooms option[value='4']").attr('selected', 'selected');
                                $("#vrooms option[value='4']").removeAttr('disabled');
                            }
                            if (childs == 5 || childs == 6) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('disabled', 'disabled');
                                $("#vrooms option[value='4']").attr('disabled', 'disabled');
                                $("#vrooms option[value='5']").attr('selected', 'selected');
                            }
                        }
                        if (adults == 5) {
                            $("#vrooms option[value='1']").attr('disabled', 'disabled');
                            $("#vrooms option[value='2']").attr('disabled', 'disabled');
                            $("#vrooms option[value='3']").attr('disabled', 'disabled');
                            $("#vrooms option[value='4']").attr('disabled', 'disabled');
                            $("#vrooms option[value='5']").attr('selected', 'selected');
                            $("#vrooms option[value='5']").removeAttr('disabled');
                            if (childs == 1 || childs == 2 || childs == 3 || childs == 4 || childs == 5) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('disabled', 'disabled');
                                $("#vrooms option[value='4']").attr('disabled', 'disabled');
                                $("#vrooms option[value='5']").attr('selected', 'selected');
                                $("#vrooms option[value='5']").removeAttr('disabled');
                            }
                            if (childs == 6) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('disabled', 'disabled');
                                $("#vrooms option[value='4']").attr('disabled', 'disabled');
                                $("#vrooms option[value='5']").attr('disabled', 'disabled');
                                $("#vrooms option[value='6']").attr('selected', 'selected');
                            }
                        }
                        if (adults == 6) {
                            $("#vrooms option[value='1']").attr('disabled', 'disabled');
                            $("#vrooms option[value='2']").attr('disabled', 'disabled');
                            $("#vrooms option[value='3']").attr('disabled', 'disabled');
                            $("#vrooms option[value='4']").attr('disabled', 'disabled');
                            $("#vrooms option[value='5']").attr('disabled', 'disabled');
                            $("#vrooms option[value='6']").attr('selected', 'selected');
                            if (childs == 1 || childs == 2 || childs == 3 || childs == 4 || childs == 5 || childs == 6) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('disabled', 'disabled');
                                $("#vrooms option[value='4']").attr('disabled', 'disabled');
                                $("#vrooms option[value='5']").attr('disabled', 'disabled');
                                $("#vrooms option[value='6']").attr('selected', 'selected');
                            }
                        }
                    }
                    if (beds == 2) {
                        if (adults == 1) {
                            $("#vrooms option[value='1']").removeAttr('disabled');
                            if (childs == 1 || childs == 2) {
                                $("#vrooms option[value='1']").removeAttr('disabled');
                                $("#vrooms option[value='2']").removeAttr('disabled');
                                $("#vrooms option[value='1']").attr('selected', 'selected');
                            }
                            if (childs == 3 || childs == 4 || childs == 5) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('selected', 'selected');
                                $("#vrooms option[value='2']").removeAttr('disabled');
                            }
                            if (childs == 6) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('selected', 'selected');
                            }
                        }
                        if (adults == 2) {
                            if (childs == 0) {
                                $("#vrooms option[value='1']").removeAttr('disabled');
                                $("#vrooms option[value='2']").removeAttr('disabled');
                                $("#vrooms option[value='1']").attr('selected', 'selected');
                            }
                            if (childs == 1 || childs == 2 || childs == 3 || childs == 4) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('selected', 'selected');
                                $("#vrooms option[value='2']").removeAttr('disabled');
                            }
                            if (childs == 5 || childs == 6) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('selected', 'selected');
                            }
                        }
                        if (adults == 3) {
                            if (childs == 0 || childs == 1 || childs == 2) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('selected', 'selected');
                                $("#vrooms option[value='2']").removeAttr('disabled');
                                $("#vrooms option[value='3']").removeAttr('disabled');
                            }
                            if (childs == 3 || childs == 4 || childs == 5) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('selected', 'selected');
                                $("#vrooms option[value='3']").removeAttr('disabled');
                            }
                            if (childs == 6) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('disabled', 'disabled');
                                $("#vrooms option[value='4']").attr('selected', 'selected');
                            }
                        }
                        if (adults == 4) {
                            if (childs == 0) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('selected', 'selected');
                                $("#vrooms option[value='2']").removeAttr('disabled');
                                $("#vrooms option[value='3']").removeAttr('disabled');
                            }
                            if (childs == 1 || childs == 2 || childs == 3) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('selected', 'selected');
                                $("#vrooms option[value='3']").removeAttr('disabled');
                            }
                            if (childs == 4 || childs == 5 || childs == 6) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('disabled', 'disabled');
                                $("#vrooms option[value='4']").attr('selected', 'selected');
                            }
                        }
                        if (adults == 5) {
                            if (childs == 0 || childs == 1 || childs == 2 || childs == 3 || childs == 4) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('selected', 'selected');
                                $("#vrooms option[value='3']").removeAttr('disabled');
                            }
                            if (childs == 5 || childs == 6) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('disabled', 'disabled');
                                $("#vrooms option[value='4']").attr('selected', 'selected');
                            }
                        }
                        if (adults == 6) {
                            if (childs == 0 || childs == 1 || childs == 2 || childs == 3) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('selected', 'selected');
                                $("#vrooms option[value='3']").removeAttr('disabled');
                            }
                            if (childs == 4 || childs == 5 || childs == 6) {
                                $("#vrooms option[value='1']").attr('disabled', 'disabled');
                                $("#vrooms option[value='2']").attr('disabled', 'disabled');
                                $("#vrooms option[value='3']").attr('disabled', 'disabled');
                                $("#vrooms option[value='4']").attr('selected', 'selected');
                            }
                        }
                    }
                });


      select option[disabled] {
                display: none;
            }

我正在使用Visual Studio2015。我试图添加对System.Net.Http.WebRequest的引用,但是没有运气。有人知道问题是什么吗?非常感谢您的帮助!

0 个答案:

没有答案