Invalid length for a Base-64 char array

G

Guest

I keep getting this error. I have scoured the web and could not find any
applicable information. It seems to have really started since I upgraded to
the 1.1 framework. Any help is appreciated.

Using:
*ASP.NET 1.1
*Single machine (no clusters)
*Simple postbacks (no postbacks to different pages)
*Using only Response.Redirect() when applicable
*The page works fine. The error appears at random occasions.
*I have not been able to repro the error on my dev machine. It happens only
on my production server.


UNHANDLED Exception:
[FormatException: Invalid length for a Base-64 char array.]
System.Convert.FromBase64String(String s)
System.Web.UI.LosFormatter.Deserialize(String input)
System.Web.UI.Page.LoadPageStateFromPersistenceMedium()

[HttpException: Invalid_Viewstate_Client_Disconnected
Client IP: 204.231.101.39
Port: 1585
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322)
ViewState:
***50,369 bytes of base64 text***
Http-Referer: http://198.137.76.44/appman/ManageCustomer.aspx
Path: /appman/ManageCustomer.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
System.Web.UI.Page.LoadPageViewState()
System.Web.UI.Page.ProcessRequestMain()


User Name: xxxx
SessionID: jqg1cr45bvomc445vefeli45
Form Data:
__EVENTTARGET = "Customers"
__EVENTARGUMENT = ""


Thanks in advance,

Dan
 
G

Guest

Sounds like some of the base64 encoded characters are not making it back to
the server without modification. The same problem occurs when base64
characters are used in a URL. To be used in a URL they have to be URLEncoded,
too.

Try using HTMLEncode() on the base64 data before sending it to the browser.
 
B

bruce barker

the error is coming from the framework trying to load the __viewstate hidden
field. the common cause for this error, is the viewstate is very large, and
a proxy server is truncating it, causing the error. be sure your length of
your viewstate is under 2k.

-- bruce (sqlwork.com)



| I keep getting this error. I have scoured the web and could not find any
| applicable information. It seems to have really started since I upgraded
to
| the 1.1 framework. Any help is appreciated.
|
| Using:
| *ASP.NET 1.1
| *Single machine (no clusters)
| *Simple postbacks (no postbacks to different pages)
| *Using only Response.Redirect() when applicable
| *The page works fine. The error appears at random occasions.
| *I have not been able to repro the error on my dev machine. It happens
only
| on my production server.
|
|
| UNHANDLED Exception:
| [FormatException: Invalid length for a Base-64 char array.]
| System.Convert.FromBase64String(String s)
| System.Web.UI.LosFormatter.Deserialize(String input)
| System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
|
| [HttpException: Invalid_Viewstate_Client_Disconnected
| Client IP: 204.231.101.39
| Port: 1585
| User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
| CLR 1.1.4322)
| ViewState:
| ***50,369 bytes of base64 text***
| Http-Referer: http://198.137.76.44/appman/ManageCustomer.aspx
| Path: /appman/ManageCustomer.aspx.]
| System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
| System.Web.UI.Page.LoadPageViewState()
| System.Web.UI.Page.ProcessRequestMain()
|
|
| User Name: xxxx
| SessionID: jqg1cr45bvomc445vefeli45
| Form Data:
| __EVENTTARGET = "Customers"
| __EVENTARGUMENT = ""
|
|
| Thanks in advance,
|
| Dan
 
G

Guest

Bruce,

The puzzle is that things work sometime and not others, so I don't know why
there would be a length limit that takes effect only some times (the exact
same data is being transferred). The large viewstate is the result of a
DropdownList control (I will look into removing the need for viewstate) and
is definitively larger than 2K. Other pages use a DataGrid control with an
even larger viewstate and have this problem only rarely (if at all).

I wonder if "Invalid_Viewstate_Client_Disconnected" is a clue.

Any other thoughts?

Regards,

Dan
 
S

SmashHuevo

I'm seeing this error, as well--and it seems to come from thefact that our users will do something that triggers a postback(e.g. select an item from a DropDownList), and then do somethingthat triggers another one, before the first request hasreturned. This seems to truncate the viewstate mid-request, andcause this error.

Anyone have any ideas on how to fix this?
I keep getting this error. I have scoured the web and could notfind any
applicable information. It seems to have really started since Iupgraded to
the 1.1 framework. Any help is appreciated.

Using:
*ASP.NET 1.1
*Single machine (no clusters)
*Simple postbacks (no postbacks to different pages)
*Using only Response.Redirect() when applicable
*The page works fine. The error appears at random occasions.
*I have not been able to repro the error on my dev machine. Ithappens only
on my production server.


UNHANDLED Exception:
[FormatException: Invalid length for a Base-64 char array.]
System.Convert.FromBase64String(String s)
System.Web.UI.LosFormatter.Deserialize(String input)
System.Web.UI.Page.LoadPageStateFromPersistenceMedium()

[HttpException: Invalid_Viewstate_Client_Disconnected
Client IP: 204.231.101.39
Port: 1585
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT5.1; SV1; .NET
CLR 1.1.4322)
ViewState:
***50,369 bytes of base64 text***
Http-Referer:http://198.137.76.44/appman/ManageCustomer.aspx
Path: /appman/ManageCustomer.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
System.Web.UI.Page.LoadPageViewState()
System.Web.UI.Page.ProcessRequestMain()


User Name: xxxx
SessionID: jqg1cr45bvomc445vefeli45
Form Data:
__EVENTTARGET = "Customers"
__EVENTARGUMENT = ""


Thanks in advance,

Dan
User submitted from AEWNET (http://www.aewnet.com/)
 
A

Alvin Bruney [MVP - ASP.NET]

nope, i don't think that is the case. i'm looking into this issue with
microsoft under thread invalid viewstate. if you can reproduce it please
send email to (e-mail address removed) subject line invalid viewstate

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc
I'm seeing this error, as well--and it seems to come from the fact that our
users will do something that triggers a postback (e.g. select an item from a
DropDownList), and then do something that triggers another one, before the
first request has returned. This seems to truncate the viewstate
mid-request, and cause this error.

Anyone have any ideas on how to fix this?
I keep getting this error. I have scoured the web and could not find any
applicable information. It seems to have really started since I upgraded
to
the 1.1 framework. Any help is appreciated.

Using:
*ASP.NET 1.1
*Single machine (no clusters)
*Simple postbacks (no postbacks to different pages)
*Using only Response.Redirect() when applicable
*The page works fine. The error appears at random occasions.
*I have not been able to repro the error on my dev machine. It happens
only
on my production server.


UNHANDLED Exception:
[FormatException: Invalid length for a Base-64 char array.]
System.Convert.FromBase64String(String s)
System.Web.UI.LosFormatter.Deserialize(String input)
System.Web.UI.Page.LoadPageStateFromPersistenceMedium()

[HttpException: Invalid_Viewstate_Client_Disconnected
Client IP: 204.231.101.39
Port: 1585
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322)
ViewState:
***50,369 bytes of base64 text***
Http-Referer: http://198.137.76.44/appman/ManageCustomer.aspx
Path: /appman/ManageCustomer.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
System.Web.UI.Page.LoadPageViewState()
System.Web.UI.Page.ProcessRequestMain()


User Name: xxxx
SessionID: jqg1cr45bvomc445vefeli45
Form Data:
__EVENTTARGET = "Customers"
__EVENTARGUMENT = ""


Thanks in advance,

Dan
User submitted from AEWNET (http://www.aewnet.com/)
 
Joined
Dec 19, 2008
Messages
1
Reaction score
0
Invalid lenght error

I found that the Convert.FromBase64String causes this error if there is a space in the string that you want to convert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top