2011-10-21 2 views
2

페이지 새로 고침없이 파일을 업로드하려고합니다. ASP.net 및 C#에서이 작업을 수행합니다. iframe을 대상으로하고이를 다시 만들려는 양식을 가진 사람들의 사례를 많이 보았습니다. 하지만이 예제들은 모두 PHP로되어있어서 나는 장님이된다. 이 문제를 해결했지만 제출할 때 잘못된 뷰 상태 오류가 계속 발생합니다. 어떤 도움에 감사드립니다포스트 백이 아닌 asp.net에서 파일 업로드

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] 

:이 때

<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> 

, 나는이 오류가 발생합니다.

+0

ASP.NET MVC 또는 웹 양식을 사용하고 있습니까? – LewisBenge

+0

나는이 말을하기 위해 당혹 스럽지만 확실하지 않습니다. 너 어떻게 말하는거야? 내가 aspx 파일을 사용하고 있다는 것을 알고, 그 도움이됩니까? 코드에서 알 수 있듯이 ASP 컨트롤 사용을 피하려고합니다. 그 주된 이유는 서버 클릭 이벤트를 사용하고 싶지 않기 때문입니다. 아마도 필자는 파일 형식을 기본 페이지에두고 iframe을 대상으로 삼아서 필요한 것보다 더 복잡하게 만들 것입니다. iframe에 파일 형식을두면이 방법이 더 쉬울 것이라고 생각합니다. – griztown

+0

웹 양식을 사용하는 경우 [here] (http://midnightprogrammer.net/post/Upload-Multiple-Files-With-jQuery-Uploadify.aspx)를 읽고 MVC를 사용하는 경우 [here] (http : //midnightprogrammer.net/post/Upload-Files-In-RAZOR-With-jQuery-Uploadify-Plugin.aspx) 및 [here] (http://midnightprogrammer.net/post/Upload-and-Show-Image- Without-Post-Back-With-Jquery.aspx) – Prashant

답변

관련 문제