gpt4 book ai didi

c# - 在没有回发的情况下在 asp.net 中上传文件

转载 作者:太空宇宙 更新时间:2023-11-03 14:11:04 24 4
gpt4 key购买 nike

我正在尝试在不刷新页面的情况下上传文件。我正在使用 ASP.net 和 C# 执行此操作。我发现了很多人拥有针对 iframe 的表单并试图重新创建它的示例。但是这些例子都在 php 中,所以我有点盲目。我已经设置好了,但是在提交时我一直收到无效的 View 状态错误。

<div id="FileUploadDiv" class="hidden">
<form id="form2" action="FileUpload.aspx" enctype="multipart/form-data" runat="server" target="fileFrameP">
File: <input type="file" name="fileUpload" />
<input type="hidden" id="FileReviewID" value="" />
<input type="submit" name="fileSubmit" value="Submit" />
</form>
<iframe id="fileFrameP" name="fileFrameP" src="#" style="width:0; height:0; border:0px;"></iframe>
</div>

当我尝试这个时,我得到了这个错误:

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

Source Error:


[No relevant source lines]

感谢任何帮助。

最佳答案

您可以使用 Ajax uploader 或 SWFUpload .

关于c# - 在没有回发的情况下在 asp.net 中上传文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7844390/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com