简体   繁体   English

IIS7根据请求停止提供文件,但允许ajax回调

[英]IIS7 stop serving file on request but allows ajax callback

Basically I'm a bit lost I need to allow a jQuery callback the ability to access a web function via an ajax post. 基本上我有点迷失了,我需要允许jQuery回调通过ajax发布访问Web函数的功能。

$.ajax({
         type: "POST",
         url: "/Methods/Credit.asmx/PaymentHoldingDocument1",
         data: "{iCredits: " + $('#creditAmount').val() + ", iClientId: " + window.iUserId + "}",
         contentType: "application/json; charset=utf-8",
         dataType: "json"
        });

This then updates a document in a directory \\Payment\\Holding\\1.txt but I don't want people the ability to view the document once it's been created so I want to hide that once it's been created. 然后,这会更新\\ Payment \\ Holding \\ 1.txt目录中的文档,但我不希望人们能够在创建文档后查看该文档,因此我想在创建后将其隐藏。 Using the following in the web.config I've been able to stop people viewing the file but it also stops the web method from writing to it as well. 使用web.config中的以下命令,我已经能够阻止人们查看该文件,但是它也阻止了web方法写入文件。

<security>
   <requestFiltering>
      <hiddenSegments>
         <add segment="\Payment\" />
      </hiddenSegments>
   </requestFiltering>
 </security>

Is there something I'm missing? 有什么我想念的吗? or is it something I can not do?. 还是我不能做的事情?

Also removing IUSR or IIS_USR isn't an option as this stops me writing to the file as well. 也不能删除IUSRIIS_USR因为这也使我无法写入该文件。

Thanks in advance. 提前致谢。

Have you tried putting a denial on *.txt files by creating a request filter in IIS? 您是否尝试过通过在IIS中创建请求过滤器来对* .txt文件进行拒绝? That prevents things like the web.config files from being downloaded. 这样可以防止下载诸如web.config文件之类的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM