小编Sle*_*tte的帖子

反序列化不同对象类型的数组

使用Json.NET库,我无法将一些返回的json反序列化为数组.json是一个包含一些分页信息的数组,作为对象和国家/地区对象的数组.这是返回的json的示例:

[
    {
        "page": 1,
        "pages": 6,
        "per_page": "50",
        "total": 262
    },
    [
        {
            "id": "ABW",
            "iso2Code": "AW",
            "name": "Aruba",
            "region": {
                "id": "LCN",
                "value": "Latin America & Caribbean (all income levels)"
            },
            "adminregion": {
                "id": "",
                "value": ""
            },
            "incomeLevel": {
                "id": "NOC",
                "value": "High income: nonOECD"
            },
            "lendingType": {
                "id": "LNX",
                "value": "Not classified"
            },
            "capitalCity": "Oranjestad",
            "longitude": "-70.0167",
            "latitude": "12.5167"
        }
    ]
]
Run Code Online (Sandbox Code Playgroud)

我试图反序列化为以下类型:

class CountriesQueryResults
{
    public PagingInfo PageInfo { get; set; }
    public …
Run Code Online (Sandbox Code Playgroud)

c# json.net

5
推荐指数
1
解决办法
4039
查看次数

IIS 7.5 上的 URL 重写问题

我正在尝试使用 IIS 7.5 的 URL 重写模块将我的 ASP.NET 网站的所有 HTTP 请求重定向到 HTTPS。该网站目前运行良好,但强制用户在地址栏中输入 https://。

我按照本文中的说明进行操作。一切似乎都很好:我尝试将规则放入 web.config 中,它会按预期显示在 UI 中;我也做了相反的操作,当我使用 UI 添加规则时,可以看到 web.config 中的更改。我未选中该网站的 RequireSSL。不幸的是,当我尝试通过 http:// 访问该网站时,我仍然收到 404 错误。

我尝试了几种不同的操作网址,包括 {HTTP_HOST}/{R:1} 和下面显示的网址..没有任何效果。

<system.webServer>
  <rewrite>
    <rules>
      <rule name="Redirect to https" stopProcessing="true">
        <match url="(.*)" />
        <conditions>
        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
        </conditions>
        <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}"
         redirectType="SeeOther" />
      </rule>
    </rules>
  </rewrite>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)

我对此还很陌生,目前非常沮丧。看来这应该容易很多。任何建议将不胜感激,谢谢..

从 ServerFault 重新发布,因为它已经有一段时间没有得到答复了。

iis url-rewriting iis-7.5

2
推荐指数
1
解决办法
4492
查看次数

标签 统计

c# ×1

iis ×1

iis-7.5 ×1

json.net ×1

url-rewriting ×1