小编Mag*_*air的帖子

MVC 4 - GZIP压缩JSON ajax动作结果

问题

我在IIS 7.5上运行的MVC 4应用程序上有一个Telerik MVC UI网格,它可能通过AJAX返回大量JSON数据,极端情况下为800kb或更多.由于有效载荷可能很大,我想GZIP它.对于我的生活,我无法让它发挥作用.

控制器动作是:

public ActionResult _CustomBinding([DataSourceRequest] DataSourceRequest request, SearchMemberModel search)
{
    //Do some stuff

   return Json(result);
}
Run Code Online (Sandbox Code Playgroud)

提琴手报道: 在此输入图像描述

已经尝试过什么

我确保在IIS中启用了动态和静态压缩:

在此输入图像描述

App Web.Config修正:

  <system.webServer>
    <serverRuntime frequentHitThreshold="1" frequentHitTimePeriod="10:00:00" />

    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="false">
      <remove name="FormsAuthentication" />
    </modules>

    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">

      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9"  />
      <dynamicTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/json" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </dynamicTypes>
      <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" …
Run Code Online (Sandbox Code Playgroud)

c# iis model-view-controller json gzip

13
推荐指数
1
解决办法
1万
查看次数

在MVC 4网站上删除表单身份验证

背景

我创建了一个MVC 4,.Net 4.5网站,以便使用Forms身份验证,因此选择了该模板.然后更改了摘要,我需要交换使用Windows身份验证.这将推出到带有IIS8的Windows Server 2008盒子上.

问题

我不能为我的生活转身关闭表格认证.通过NTLM成功通过身份验证后,MVC会尝试将我带到表单登录页面.我试过了:

  • 将web.config更改为 <authentication mode="Windows" >
  • 更改IIS应用程序以使用"Windows身份验证"与"表单身份验证"相反(匿名身份验证当然是关闭的)
  • 我试过在评论中注释掉" AuthConfig.RegisterAuth();"和" FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);"Application_Start()
  • 我试过设置HttpResponse.SuppressFormsAuthenticationRedirectApplication_EndRequest.

这些都不起作用.唯一可怕的软糖(来自一个stackoverflow的帖子)是改变web.config中的下面 - 这有一些时髦的副作用(当应用程序不应该例如时,在导航时弹回Home):

<authentication mode="Windows" >
  <!--<forms loginUrl="~/Account/Login" timeout="2880" />-->
  <forms loginUrl="~/Home" timeout="2880" />
</authentication>
Run Code Online (Sandbox Code Playgroud)

这个问题

我觉得我错过了一些令人眼花缭乱的明显(可能是过滤器相关的)我需要做的更改,以禁用和从项目中删除表单auth.任何人都可以建议我需要采取永久删除的步骤吗?

iis forms-authentication windows-authentication asp.net-mvc-4

3
推荐指数
1
解决办法
4222
查看次数

使用Jquery查找td的表的父表

我正在定制Sage CRM,所以我无法控制所写的HTML,也无法将ID或类添加到CRM吐出的表格布局中.我想根据用户选择的选择下拉列表隐藏更高(不是顶级)级别的表.我只能将一个jQuery选择器挂在我要隐藏的表中的表的标题行上.

DOM类似于:

//Lots of other table structures above this in the DOM....
<table>  <---- this is the table I want to show or hide based on the users selection
  <tbody>
    <tr>
     <td>
       <table>
         <tbody>
           <tr>
             <td class="PANEREPEAT">  <---- this is the node I can get selector to
                 Valuation information
////
Run Code Online (Sandbox Code Playgroud)

所以我做了以下客户端javascript:

    var val_information_screen;

    $('.PANEREPEAT').filter(function () {
        //Find the valuation information screen
        return $(this).text() == 'Valuation information';
    }).each(function () { //iterate through all of these (there should only be one!) …
Run Code Online (Sandbox Code Playgroud)

javascript jquery crm sage-crm

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