C#的StringPath()函数

时间:2017-03-03 04:50:09

标签: c#

我正在学习本教程。它要求我将此代码粘贴到我的Startup.cs文件配置方法中:

app.UseCookieAuthentication(new CookieAuthenticationOptions
    {
        AuthenticationScheme = "Cookies",
        LoginPath = new StringPath("/Account/Login"),
        AccessDeniedPath = new StringPath("/Home/Forbidden"),
        AutomaticAuthenticate = true,
        AutomaticChallenge = true
    });

StringPath()对象抛出错误。缺少指令或参考。无论出于何种原因,当我google StringPath()C#或任何接近它的东西时,我都没有得到任何结果。它不建议在我的文件中包含名称空间。该对象属于哪个命名空间?

1 个答案:

答案 0 :(得分:2)

我猜你跟着this tutorial或者它的一些副本,可能是拼写错误。

看一下,这里使用的是PathString结构,而不是StringPath