Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

InputBox causes ViewState Validation failure

Posted on 2008-10-02
2
Medium Priority
?
279 Views
Last Modified: 2013-11-07
I am getting an error in my VB code: "Validation of viewstate MAC failed".  Note that I am NOT using a cluster environment, the viewstate mac failure seems to be a "catchall" error message for Microsoft, so the error message has no helpful information.

To see the error goto: http://www.thedesk.info/myplan/printerFriendlyTop2.aspx?domain=community&pageToPrint=print.aspx
then click "Email".  All of the other options work.

I have determined that by removing a call to InputBox, the error goes away.  Also, the error states that I can get more information by making debug="true", but it is both globally and in the page.

Does anyone know why a call to InputBox would cause this error and how I can get around it?  My web.config is as follows:

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Web.Config Configuration File -->

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <system.web>
        <customErrors mode="Off"/>
                        <pages validateRequest="false" enableEventValidation="false" viewStateEncryptionMode ="Never" />
        <compilation debug="true"/>
          </system.web>
</configuration>
<%@ Page Language="VB"%>
<script language="VB" runat="Server">
 
...
 
  Sub SendEmail(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim email As String = InputBox("Please enter your email address")
    Dim pageToLoad As String = "print.aspx?domain=" & domain.Value & "&userName=" & userName.Value
    Dim tx As New System.IO.StringWriter
    Server.Execute(pageToLoad, tx)
	  
    Dim ct As System.Net.Mime.ContentType = New System.Net.Mime.ContentType(System.Net.Mime.MediaTypeNames.Text.Html)
    Dim plan As Net.Mail.Attachment = Net.Mail.Attachment.CreateAttachmentFromString(tx.ToString(), ct)
    plan.ContentDisposition.FileName = "myplan_" & domain.Value & ".html"
    plan.ContentDisposition.DispositionType = System.Net.Mime.MediaTypeNames.Text.Html
		
    Dim msg As String = "Your plan is attached"
    GeneralFunctionsVB.mail(email, "MyPlan", "myplan@thedesk.info", msg, Nothing, Nothing, 0, plan)
  End Sub
</script>
 
...
 
<!-- The .NET code for handling the Email link -->
<asp:LinkButton ID="EmailLink" runat="server" CssClass="actionLink" OnClick="SendEmail">Email...</asp:LinkButton>

Open in new window

0
Comment
Question by:dageyra
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
NazoUK earned 1500 total points
ID: 22628635
You can't use InputBox in an asp.net page, how would it work?
Put a textbox on your page, if necessary to have it as a pop-up you'll need to do it with javascript or the modalpopupextender from the ajax toolkit or something similar.
0
 
LVL 1

Author Comment

by:dageyra
ID: 22672632
HI:

I wanted to let you know that I worked it out with JavaScript, you were right, the InputBox would not work--though I am still confused as to why it generates a "ViewState" failure.  
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question