Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 2 of 2

Thread: customer file uploader

  1. #1
    press is offline Member
    Join Date
    May 2009
    Posts
    31

    Default customer file uploader

    Hello i am working on a customer file uploader. This is pre-sale, so i dont want it part of a kit. Basically a custom contact form with ability for client to upload a pdf or word doc. I borrowed some code from cforrester, but cannot get it to work.

    The form has a file browse button and a submit button:

    <body>
    <form name="form1" method="post" action="upload_logo.aspx?cid=0&amp;pid=82&amp;lip= 000.000.187.37" id="form1" enctype="multipart/form-data">
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNTYzNDA0Mjg1D2QWAgIDDxYCHgdlbmN0eXBlBRNtdWx 0aXBhcnQvZm9ybS1kYXRhZGTl6YqW40Hxqtnpf8q0qjkAjbLda w==" />

    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLEsfvwBwKx6NOBD0FALG6b8YUhxUMegqbMqR4a27MF" />
    <strong>&nbsp;<br />
    Upload RFQ or Program</strong><br />

    </strong>
    <br />
    Click Browse to select your RFQ file; then click Upload File to upload the file
    to our server.<br />
    <br />
    <input type="file" name="fu" id="fu" /><br />

    <br />

    <input type="submit" name="uxUpload" value="Upload File" id="uxUpload" /


    It fails on upload with the following error from aspdotnetstorefront:

    [ViewStateException: Invalid viewstate.
    Client IP: 000.000.15.233
    Port: 64074
    User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
    ViewState: /wEPDwUJNTYzNDA0Mjg1D2QWAgIDDxYCHgdlbmN0eXBlBRNtdWx 0aXBhcnQvZm9ybS1kYXRhZGTl6YqW40Hxqtnpf8q0qjkAjbLda w==
    Referer: http://www.mydomain.com/upload_logo....=174.36.187.37
    Path: /upload_logo.aspx]

    [HttpException (0x80004005): 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.]
    System.Web.UI.ViewStateException.ThrowError(Except ion inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106
    System.Web.UI.ViewStateException.ThrowMacValidatio nError(Exception inner, String persistedState) +14
    System.Web.UI.ObjectStateFormatter.Deserialize(Str ing inputString) +237
    System.Web.UI.ObjectStateFormatter.System.Web.UI.I StateFormatter.Deserialize(String serializedState) +4
    System.Web.UI.Util.DeserializeWithAssert(IStateFor matter formatter, String serializedState) +37
    System.Web.UI.HiddenFieldPageStatePersister.Load() +207
    System.Web.UI.Page.LoadPageStateFromPersistenceMed ium() +105
    System.Web.UI.Page.LoadAllState() +43
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
    System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
    System.Web.UI.Page.ProcessRequest() +80
    System.Web.UI.Page.ProcessRequestWithNoAssert(Http Context context) +21
    System.Web.UI.Page.ProcessRequest(HttpContext context) +49
    ASP.upload_logo_aspx.ProcessRequest(HttpContext context) +4
    System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +181
    System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +75

    I dont know what the CID, PID, and LIP do? Any suggestions greatly appreciated.


    Press

  2. #2
    press is offline Member
    Join Date
    May 2009
    Posts
    31

    Default

    Well i removed the two lines:

    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNTYzNDA0Mjg1D2QWAgIDDxYCHgdlbmN0eXBlBRNtdWx 0aXBhcnQvZm9ybS1kYXRhZGTl6YqW40Hxqtnpf8q0qjkAjbLda w==" />

    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLEsfvwBwKx6NOBD0FALG6b8YUhxUMegqbMqR4a27MF" />

    and now it does not throw the error, but then again, it does not do anything.

    Is there a code behind that should go with this? Any assistance would be greatly appreciated.

    Press