Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Angeruzzi  
#1 Posted : Sunday, October 02, 2005 11:36:30 PM(UTC)
Angeruzzi

Rank: Member

Groups: Member
Joined: 10/2/2005(UTC)
Posts: 6

Hi. I have had a problem with the Image Uploader.
At moment of upload is displayed a message "Some server-side error ocurred".
I set the "ShowDebugWindow" with "true" that showed me the Stack trace below:


Code:
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +195
System.Web.UI.LosFormatter.Deserialize(String input) +60

[HttpException (0x80004005): Authentication of viewstate failed. 1) If this is a cluster, edit <machineKey> configuration so all servers use the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 2) Viewstate can only be posted back to the same page. 3) The viewstate for this page might be corrupted.]
System.Web.UI.LosFormatter.Deserialize(String input) +118
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +101

[HttpException (0x80004005): Invalid_Viewstate
Client IP: 192.168.0.16
Port: 4265
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
ViewState: dDw4Nzk5OTI2NTI7Oz7wtC/vn1ERrs6m2JQCWaEW+O9A3A==
Http-Referer: 
Path: /upload.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +442
System.Web.UI.Page.LoadPageViewState() +18
System.Web.UI.Page.ProcessRequestMain() +447



It indicates that the View State is invalid in the page's post. I think that it is happend because the page is been posted in another page for the upload's component. Am i right? How will i fixed this?

Edited by user Sunday, December 23, 2007 5:18:09 PM(UTC)  | Reason: Not specified

Alessandro S. Angeruzzi
Depto. Tecnologia
Webroom Soluções Interativas
Fedor  
#2 Posted : Monday, October 03, 2005 9:28:06 PM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,546

Thanks: 5 times
Was thanked: 58 time(s) in 57 post(s)
Hello,

Quote:
Angeruzzi (10/3/2005)
Hi. I have had a problem with the Image Uploader.
At moment of upload is displayed a message "Some server-side error ocurred".
I set the "ShowDebugWindow" with "true" that showed me the Stack trace below:

...

It indicates that the View State is invalid in the page's post. I think that it is happend because the page is been posted in another page for the upload's component. Am i right? How will i fixed this?


In short the problem is in specifying server form in AdditionalFormName property.

Code:
<form ID="Form1">
...
</form>
...
<script type="text/javascript">
var iu = new ImageUploaderWriter("ImageUploaderID", 610, 500);
//...
iu.addParam("AdditionalFormName", "Form1");
//...
iu.writeHtml();
</script>


In this case the ASP.NET autogenerated __VIEWSTATE field is uploaded with the file data as well, and ASP.NET upload mechanism treats the request as postback and so failes to parse it. To solve the problem just attach non-server form. You can use System.Web.UI.HtmlControls instead of System.Web.UI.WebControls to work with elements of non-server form.

Edited by user Tuesday, February 26, 2008 2:20:54 AM(UTC)  | Reason: Not specified

Best regards,
Fedor Skvortsov
Angeruzzi  
#3 Posted : Monday, October 03, 2005 11:08:24 PM(UTC)
Angeruzzi

Rank: Member

Groups: Member
Joined: 10/2/2005(UTC)
Posts: 6

Fedor, thank for your help.
But I have one doubt.
The object ImageUploader needs to be out of the form ? or not?
If it is true, it could cause a problem for me.


So, I solve this problem with another solution.
I process the upload of the images on itself page.
I set in Action property the same component's page with a query string that identify the upload.

...
obj.addParam("Action", "samepage.aspx?upload=true");
...

On Page Load I identify the querystring and process the upload normally. This solution sounds good?
Alessandro S. Angeruzzi
Depto. Tecnologia
Webroom Soluções Interativas
Fedor  
#4 Posted : Wednesday, October 05, 2005 3:06:55 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,546

Thanks: 5 times
Was thanked: 58 time(s) in 57 post(s)
Hello,

I am sorry for delay.

Quote:
Angeruzzi (10/4/2005)
Fedor, thank for your help.
But I have one doubt.
The object ImageUploader needs to be out of the form ? or not?


It doesn't matter. Image Uploader just should not attach server form as I said before. Actually Image Uploader ignores placing on page and sends data in separate request, that's why for example you need to handle upload completion manually.

Quote:
Angeruzzi (10/4/2005)
So, I solve this problem with another solution.
I process the upload of the images on itself page.
I set in Action property the same component's page with a query string that identify the upload.

...
obj.addParam("Action", "samepage.aspx?upload=true");
...

On Page Load I identify the querystring and process the upload normally. This solution sounds good?


If this this approach works, use it. On other side why not just post data to separate page as in our samples?

Edited by user Wednesday, October 29, 2008 1:43:00 PM(UTC)  | Reason: Not specified

Best regards,
Fedor Skvortsov
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.