比较来自世界各地的卖家的域名和 IT 服务价格

如何从项目中删除身份验证 MVC?

我在学 MVC 从互联网使用 Visual Studio 2013.

完成项目后并通过将其部署到主机后 "publish" 他工作了很好 /在当地/.

虽然应用程序现在在进入系统时发出身份验证表单。 /出版后/. 当地他没有。 我想完全删除身份验证,作为网站 /与他所有的页面/ 打开。

抱歉,对无聊的问题,但我正在寻找,我找不到我的问题的关键,可能是因为在这方面的完全无知 framework..please.

我手动尝试 trace 我有的东西 "startup.cs", 其中包含 :


public partial class Startup
{
public void Configuration/IAppBuilder app/
{
ConfigureAuth/app/;

}
}


它将我发送到文件 "Startup.Auth", 它自动有 :


public void ConfigureAuth/IAppBuilder app/
{

// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication/new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString/"/Account/Login"/
}/;
// Use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseExternalSignInCookie/DefaultAuthenticationTypes.ExternalCookie/;
...


当您尝试删除函数调用时 Startup.cs 该项目立即发布一个非常简单的登录菜单。

然后在我的项目的设置中保存和 "windows authentication", 和 "anonymous authentication" DISABLED. 保存对功能的调用 "Startup.cs".

但在这种情况下,他抛出了 "this page has a redirect loop"..

请帮助我,我很困惑 : 我想完全删除身份验证。
已邀请:

三叔

赞同来自:

你必须简单
https://technet.microsoft.com/ ... .aspx
IIS 为您的网站。

此外,如果你使用 AuthorizeAttribute, 您可以标记控制器/操作,访问应该是匿名的,使用 AllowAnonymousAttribute. 仍然包含匿名身份验证 IIS.
如果您正在使用 AuthorizeAttribute 而且您无法删除它或使用标记操作 AllowAnonymous, 您应该手动创建一些虚构的用户识别。 但这是另一个讨论的问题。

为避免重定向登录页面,必须将身份验证模式设置为 "None" 在你的 web.config

帅驴

赞同来自:

提交以下代码 web.config


<modules>
<remove name="FormsAuthentication"></remove>
</modules>

小明明

赞同来自:

检查是否设置了模式 None 在你的 web.config


<system.web>
<authentication mode="None"></authentication>
</system.web>


最终 Web.Release.config

石油百科

赞同来自:

我评论了 / 移动
ConfigureAuth/app/


Startup.cs

和补充
[AllowAnonymous]

在您的家庭控制器中。 您可以将其添加到要重定向的任何控制器。 如果要重定向到另一个控制器
Home

, 请不要忘记改变
RouteConfig.cs


App_Start

.

要回复问题请先登录注册