FineUI 官方论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

本论坛已关闭(禁止注册、发帖和回复)
请移步 三石和他的朋友们

FineUI首页 WebForms - MVC & Core - JavaScript 常见问题 - QQ群 - 十周年征文活动

FineUI(开源版) 下载源代码 - 下载空项目 - 获取ExtJS - 文档 在线示例 - 版本更新 - 捐赠作者 - 教程

升级到 ASP.NET Core 3.1,快、快、快! 全新ASP.NET Core,比WebForms还简单! 欢迎加入【三石和他的朋友们】(基础版下载)

搜索
查看: 4134|回复: 7

asp.net mvc owin 环境下提交提示 网络错误,请刷新页面并重试

[复制链接]
发表于 2017-6-12 14:37:52 | 显示全部楼层 |阅读模式
本帖最后由 jxnkwlp 于 2017-6-12 14:58 编辑

asp.net mvc 项目,使用 owin 环境下, 在 提交 登录 后 , 页面提示     网络错误,请刷新页面并重试!
环境是 server 2008 r2  ,   在 VS 2015 开发环境下 不存在这个问题。  换了好几个 server 2008 r2 都会这样 。

使用 默认的空项目:  代码如下,
1,安装  Microsoft.Owin.Security.Cookies 及对应的依赖包
      安装 Microsoft.Owin.Host.SystemWeb  包,
2,   添加  Startup  启动文件。
  1. [assembly: OwinStartup(typeof(FineUIMvc.EmptyProject.Startup))]

  2. namespace FineUIMvc.EmptyProject
  3. {
  4.     public class Startup
  5.     {
  6.         public void Configuration(IAppBuilder app)
  7.         {

  8.             app.UseCookieAuthentication(new Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions()
  9.             {
  10.                 AuthenticationType = "ApplicationCookie",
  11.                 LoginPath = new PathString("/home/login/"),
  12.             });

  13.         }
  14.     }
  15. }
复制代码

3,修改  HomeController  下面的  btnLogin_Click 为 :
  1.             if (tbxUserName == "admin" && tbxPassword == "admin")
  2.             {
  3.                 SignIn();

  4.                 PageContext.Redirect(Url.Action("Hello"));

  5.                 ShowNotify("成功登录!", MessageBoxIcon.Success);
  6.             }
  7.             else
  8.             {
  9.                 ShowNotify("用户名或密码错误!", MessageBoxIcon.Error);
  10.             }

  11.             return UIHelper.Result();
复制代码
SignIn  :
  1.         IAuthenticationManager AuthenticationManager
  2.         {
  3.             get
  4.             {
  5.                 return Request.GetOwinContext().Authentication;
  6.             }
  7.         }

  8.         protected void SignIn()
  9.         {
  10.             ClaimsIdentity claimIdentity = new ClaimsIdentity("ApplicationCookie");
  11.             claimIdentity.AddClaim(new Claim(ClaimTypes.Name, "admin"));
  12.             claimIdentity.AddClaim(new Claim(ClaimTypes.NameIdentifier, "admin"));
  13.             claimIdentity.AddClaim(new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", "ASP.NET Identity", "http://www.w3.org/2001/XMLSchema#string"));

  14.             AuthenticationManager.SignOut();
  15.             AuthenticationManager.SignIn(claimIdentity);
  16.         }
复制代码

相关截图




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
发表于 2017-6-12 15:41:43 | 显示全部楼层
fineuimvc 支持owin???
 楼主| 发表于 2017-6-12 16:38:34 | 显示全部楼层
zy32002 发表于 2017-6-12 15:41
fineuimvc 支持owin???

owin 只是 asp.net 向后兼容的一个扩展。    本应该 与 UI 框架 没有 关系
 楼主| 发表于 2017-6-12 17:07:58 | 显示全部楼层
只要 是 在代码中 调用了  AuthenticationManager  ,  那么 前台 点击按钮 发起  post 的时候,就去 提示  ” 网络错误,请刷新页面并重试 “  


谁知道是什么问题?   是 FineUI 的问题? 老大能说明下是不是fineui 的问题?
发表于 2017-6-12 20:15:39 | 显示全部楼层
请基于空项目重现问题,发到客服QQ:2877408506@qq.com
 楼主| 发表于 2017-6-13 09:47:31 | 显示全部楼层
sanshi 发表于 2017-6-12 20:15
请基于空项目重现问题,发到客服QQ:

已经发送邮件
发表于 2017-6-15 11:10:02 | 显示全部楼层
我在Windows 2012下测试过了,没有问题,Windows 2008 R2手上没这环境没去测试,你可以试着删减一些FineUI的调用再去测试一下,应该就能找出问题再哪儿了。
发表于 2017-6-16 17:40:59 | 显示全部楼层

我刚测试了一下,点击 登录 按钮,没有报错,直接转到 Home/Hello 页面了

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|FineUI 官方论坛 ( 皖ICP备2021006167号-1 )

GMT+8, 2024-3-29 15:06 , Processed in 0.049876 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表