ERROR: The state information is invalid for this page and might be corrupted

Discussion in 'ASP .Net Web Controls' started by Nathan Sokalski, Dec 9, 2006.

  1. I am recieving the following error on the second postback of a page I have
    written:


    The state information is invalid for this page and might be corrupted

    Stack Trace:

    [FormatException: Invalid character in a Base-64 string.]
    System.Convert.FromBase64String(String s) +0
    System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72
    System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String
    serializedState) +4
    System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter,
    String serializedState) +37
    System.Web.UI.HiddenFieldPageStatePersister.Load() +140

    [ViewStateException: Invalid viewstate.
    Client IP: 156.12.154.213
    Port: 4212
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
    CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
    ViewState:
    /wEPDwUKMTU5MTA2ODYwOWRkss85+lCwdpXAiRIXg3K0QPiFDCk=,/wEPDwUJNzM0NTM2OTI4ZGR70CFkynUOZFCdEqpCi5JMYQiXmw==
    Referer: http://www.nathansokalski.com/screenscraper.aspx
    Path: /screenscraper.aspx]

    [HttpException (0x80004005): The state information is invalid for this page
    and might be corrupted.]
    System.Web.UI.ViewStateException.ThrowError(Exception inner, String
    persistedState, String errorPageMessage, Boolean macValidationError) +116
    System.Web.UI.HiddenFieldPageStatePersister.Load() +240
    System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
    System.Web.UI.Page.LoadAllState() +35
    System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
    System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint,
    Boolean includeStagesAfterAsyncPoint) +154
    System.Web.UI.Page.ProcessRequest() +86
    System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
    System.Web.UI.Page.ProcessRequest(HttpContext context) +49
    ASP.screenscraper_aspx.ProcessRequest(HttpContext context) +4
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    +154
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
    completedSynchronously) +64



    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
    Version:2.0.50727.210

    The page is supposed to allow you to enter a URL and then display that page
    below the small form that is in my code, which is as follows:


    ScreenScraper.aspx:

    <%@ Page Language="vb" AutoEventWireup="false"
    CodeBehind="ScreenScraper.aspx.vb" Inherits="WebApplication1.ScreenScraper"
    EnableViewState="false" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ScreenScraper</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <asp:TextBox ID="txtSourcePath" runat="server" Width="800px"/>
    <asp:Button ID="btnGetSource" runat="server" Font-Bold="True"
    Text="Get Source" Width="85px"/><br/><br/>
    <asp:Label ID="lblSource" runat="server"/>
    </form>
    </body>
    </html>


    ScreenScraper.aspx.vb:

    Partial Public Class ScreenScraper : Inherits System.Web.UI.Page
    Protected Sub btnGetSource_Click(ByVal sender As System.Object, ByVal e
    As System.EventArgs) Handles btnGetSource.Click
    Dim source As New System.Net.WebClient()
    Dim utf8 As New System.Text.UTF8Encoding()
    lblSource.Text =
    utf8.GetString(source.DownloadData(txtSourcePath.Text))
    End Sub
    End Class


    Most of the web pages I could find about this error said it was related to
    ViewState, but my *.aspx file has EnableViewState="false" in the Page
    directive. My code works fine with every URL I have tried it with when it is
    the first URL I try, but the second one always gives me the error shown
    above. I tried everything I could think of, but nothing seemed to help.
    Although it may not be sufficient for other applications or pages, for this
    page just having a way to make it act as if it being opened for the first
    time would make it work (kind of like a reset or restart command?). Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
     
    Nathan Sokalski, Dec 9, 2006
    #1
    1. Advertising

  2. Nathan,

    have you tried checking for IsPostback in the Page_Load event ?

    i.e., let the code run if it's *not* a Postback and if it *is* a Postback, not let it run.

    Sub Page_Load

    If Not IsPostBack
    ' your screen scrape code

    End If
    End Sub



    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ===================================
    "Nathan Sokalski" <> wrote in message
    news:O3gCfM%...
    >I am recieving the following error on the second postback of a page I have written:
    >
    >
    > The state information is invalid for this page and might be corrupted
    >
    > Stack Trace:
    >
    > [FormatException: Invalid character in a Base-64 string.]
    > System.Convert.FromBase64String(String s) +0
    > System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72
    > System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String
    > serializedState) +4
    > System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37
    > System.Web.UI.HiddenFieldPageStatePersister.Load() +140
    >
    > [ViewStateException: Invalid viewstate.
    > Client IP: 156.12.154.213
    > Port: 4212
    > User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR
    > 2.0.50727; .NET CLR 3.0.04506.30)
    > ViewState:
    > /wEPDwUKMTU5MTA2ODYwOWRkss85+lCwdpXAiRIXg3K0QPiFDCk=,/wEPDwUJNzM0NTM2OTI4ZGR70CFkynUOZFCdEqpCi5JMYQiXmw==
    > Referer: http://www.nathansokalski.com/screenscraper.aspx
    > Path: /screenscraper.aspx]
    >
    > [HttpException (0x80004005): The state information is invalid for this page and might be
    > corrupted.]
    > System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String
    > errorPageMessage, Boolean macValidationError) +116
    > System.Web.UI.HiddenFieldPageStatePersister.Load() +240
    > System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
    > System.Web.UI.Page.LoadAllState() +35
    > System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
    > includeStagesAfterAsyncPoint) +6953
    > System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean
    > includeStagesAfterAsyncPoint) +154
    > System.Web.UI.Page.ProcessRequest() +86
    > System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
    > System.Web.UI.Page.ProcessRequest(HttpContext context) +49
    > ASP.screenscraper_aspx.ProcessRequest(HttpContext context) +4
    > System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
    > System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
    >
    >
    >
    > --------------------------------------------------------------------------------
    > Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
    >
    > The page is supposed to allow you to enter a URL and then display that page below the small form
    > that is in my code, which is as follows:
    >
    >
    > ScreenScraper.aspx:
    >
    > <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ScreenScraper.aspx.vb"
    > Inherits="WebApplication1.ScreenScraper" EnableViewState="false" %>
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    > <html xmlns="http://www.w3.org/1999/xhtml" >
    > <head runat="server">
    > <title>ScreenScraper</title>
    > </head>
    > <body>
    > <form id="form1" runat="server">
    > <asp:TextBox ID="txtSourcePath" runat="server" Width="800px"/>
    > <asp:Button ID="btnGetSource" runat="server" Font-Bold="True" Text="Get Source"
    > Width="85px"/><br/><br/>
    > <asp:Label ID="lblSource" runat="server"/>
    > </form>
    > </body>
    > </html>
    >
    >
    > ScreenScraper.aspx.vb:
    >
    > Partial Public Class ScreenScraper : Inherits System.Web.UI.Page
    > Protected Sub btnGetSource_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    > Handles btnGetSource.Click
    > Dim source As New System.Net.WebClient()
    > Dim utf8 As New System.Text.UTF8Encoding()
    > lblSource.Text = utf8.GetString(source.DownloadData(txtSourcePath.Text))
    > End Sub
    > End Class
    >
    >
    > Most of the web pages I could find about this error said it was related to ViewState, but my
    > *.aspx file has EnableViewState="false" in the Page directive. My code works fine with every URL I
    > have tried it with when it is the first URL I try, but the second one always gives me the error
    > shown above. I tried everything I could think of, but nothing seemed to help. Although it may not
    > be sufficient for other applications or pages, for this page just having a way to make it act as
    > if it being opened for the first time would make it work (kind of like a reset or restart
    > command?). Thanks.
    > --
    > Nathan Sokalski
    >
    > http://www.nathansokalski.com/
    >
     
    Juan T. Llibre, Dec 10, 2006
    #2
    1. Advertising

  3. Other than the first time, doesn't it have to be a postback in order for
    Page_Load to even get triggered? I know how to check whether something is a
    postback, but since I am expecting this to always be a postback, I don't see
    much point in checking since if btnGetSource_Click is being called I know it
    is a postback, since I never call btnGetSource_Click from within the code.
    If I am misunderstanding your suggestion, could you try posting it? The code
    that you posted would not let the user specify the URL, and it would only do
    one screenscrape. Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    "Juan T. Llibre" <> wrote in message
    news:uGz1Pf$...
    > Nathan,
    >
    > have you tried checking for IsPostback in the Page_Load event ?
    >
    > i.e., let the code run if it's *not* a Postback and if it *is* a Postback,
    > not let it run.
    >
    > Sub Page_Load
    >
    > If Not IsPostBack
    > ' your screen scrape code
    >
    > End If
    > End Sub
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq : http://asp.net.do/faq/
    > foros de asp.net, en español : http://asp.net.do/foros/
    > ===================================
    > "Nathan Sokalski" <> wrote in message
    > news:O3gCfM%...
    >>I am recieving the following error on the second postback of a page I have
    >>written:
    >>
    >>
    >> The state information is invalid for this page and might be corrupted
    >>
    >> Stack Trace:
    >>
    >> [FormatException: Invalid character in a Base-64 string.]
    >> System.Convert.FromBase64String(String s) +0
    >> System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72
    >>
    >> System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String
    >> serializedState) +4
    >> System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter,
    >> String serializedState) +37
    >> System.Web.UI.HiddenFieldPageStatePersister.Load() +140
    >>
    >> [ViewStateException: Invalid viewstate.
    >> Client IP: 156.12.154.213
    >> Port: 4212
    >> User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
    >> CLR 1.1.4322; .NET CLR
    >> 2.0.50727; .NET CLR 3.0.04506.30)
    >> ViewState:
    >> /wEPDwUKMTU5MTA2ODYwOWRkss85+lCwdpXAiRIXg3K0QPiFDCk=,/wEPDwUJNzM0NTM2OTI4ZGR70CFkynUOZFCdEqpCi5JMYQiXmw==
    >> Referer: http://www.nathansokalski.com/screenscraper.aspx
    >> Path: /screenscraper.aspx]
    >>
    >> [HttpException (0x80004005): The state information is invalid for this
    >> page and might be
    >> corrupted.]
    >> System.Web.UI.ViewStateException.ThrowError(Exception inner, String
    >> persistedState, String
    >> errorPageMessage, Boolean macValidationError) +116
    >> System.Web.UI.HiddenFieldPageStatePersister.Load() +240
    >> System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
    >> System.Web.UI.Page.LoadAllState() +35
    >> System.Web.UI.Page.ProcessRequestMain(Boolean
    >> includeStagesBeforeAsyncPoint, Boolean
    >> includeStagesAfterAsyncPoint) +6953
    >> System.Web.UI.Page.ProcessRequest(Boolean
    >> includeStagesBeforeAsyncPoint, Boolean
    >> includeStagesAfterAsyncPoint) +154
    >> System.Web.UI.Page.ProcessRequest() +86
    >> System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
    >> System.Web.UI.Page.ProcessRequest(HttpContext context) +49
    >> ASP.screenscraper_aspx.ProcessRequest(HttpContext context) +4
    >>
    >> System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    >> +154
    >> System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
    >> completedSynchronously) +64
    >>
    >>
    >>
    >> --------------------------------------------------------------------------------
    >> Version Information: Microsoft .NET Framework Version:2.0.50727.42;
    >> ASP.NET Version:2.0.50727.210
    >>
    >> The page is supposed to allow you to enter a URL and then display that
    >> page below the small form
    >> that is in my code, which is as follows:
    >>
    >>
    >> ScreenScraper.aspx:
    >>
    >> <%@ Page Language="vb" AutoEventWireup="false"
    >> CodeBehind="ScreenScraper.aspx.vb"
    >> Inherits="WebApplication1.ScreenScraper" EnableViewState="false" %>
    >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    >> <html xmlns="http://www.w3.org/1999/xhtml" >
    >> <head runat="server">
    >> <title>ScreenScraper</title>
    >> </head>
    >> <body>
    >> <form id="form1" runat="server">
    >> <asp:TextBox ID="txtSourcePath" runat="server" Width="800px"/>
    >> <asp:Button ID="btnGetSource" runat="server" Font-Bold="True"
    >> Text="Get Source"
    >> Width="85px"/><br/><br/>
    >> <asp:Label ID="lblSource" runat="server"/>
    >> </form>
    >> </body>
    >> </html>
    >>
    >>
    >> ScreenScraper.aspx.vb:
    >>
    >> Partial Public Class ScreenScraper : Inherits System.Web.UI.Page
    >> Protected Sub btnGetSource_Click(ByVal sender As System.Object, ByVal
    >> e As System.EventArgs)
    >> Handles btnGetSource.Click
    >> Dim source As New System.Net.WebClient()
    >> Dim utf8 As New System.Text.UTF8Encoding()
    >> lblSource.Text =
    >> utf8.GetString(source.DownloadData(txtSourcePath.Text))
    >> End Sub
    >> End Class
    >>
    >>
    >> Most of the web pages I could find about this error said it was related
    >> to ViewState, but my
    >> *.aspx file has EnableViewState="false" in the Page directive. My code
    >> works fine with every URL I
    >> have tried it with when it is the first URL I try, but the second one
    >> always gives me the error
    >> shown above. I tried everything I could think of, but nothing seemed to
    >> help. Although it may not
    >> be sufficient for other applications or pages, for this page just having
    >> a way to make it act as
    >> if it being opened for the first time would make it work (kind of like a
    >> reset or restart
    >> command?). Thanks.
    >> --
    >> Nathan Sokalski
    >>
    >> http://www.nathansokalski.com/
    >>

    >
    >
    >
     
    Nathan Sokalski, Dec 10, 2006
    #3
  4. re:
    > My code works fine with every URL I have tried it with when it is
    > the first URL I try, but the second one always gives me the error


    Hi, Nathan.

    I checked the page and what it produces is really curious.

    I was able to get several pages in a row from my domain without problem.
    Then I requested Microsoft's main page. No problem, either.
    Then I requested Google's main page. It faulted with this error text :

    ---000---
    Invalid postback or callback argument. Event validation is enabled using
    <pages enableEventValidation="true"/> in configuration or
    <%@ Page EnableEventValidation="true" %> in a page.

    For security purposes, this feature verifies that arguments to postback or callback
    events originate from the server control that originally rendered them.
    If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation
    method in order to register the postback or callback data for validation.
    ---000---

    You might want to consider looking into that.

    Also, I notice that you have different versions of the .Net Framework installed :
    > Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210


    That could certainly be a problem in many scenarios,
    including the ones in your post and my response.

    It looks like you installed SBS or some other Windows 2003 server OS
    which was running a beta version of ASP.NET (version 2.0.50727.210),
    and when you upgraded to the RTM/release, some part of the setup didn't complete.

    It would be highly advantageous for you to fully upgrade to the RTM version (2.0.50727.42).

    Running aspnet_regiis -i should do it( from the .Net Framework 2.0 directory ),
    if you don't have ASP.NET 1.1 apps running.

    If you do have ASP.NET 1.1 apps running, you can re-register them with
    aspnet_regiis -s ( from the .Net Framework 1.1 directory )

    Remember to run 1.1 apps and 2.0 apps in different Application Pools.

    Re your comment about it always being a postback, yes, you're right.
    Sorry for misunderstanding the purpose of the page.

    Hope these comments help you sort the situation.



    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ===================================
    "Nathan Sokalski" <> wrote in message
    news:...
    > Other than the first time, doesn't it have to be a postback in order for Page_Load to even get
    > triggered? I know how to check whether something is a postback, but since I am expecting this to
    > always be a postback, I don't see much point in checking since if btnGetSource_Click is being
    > called I know it is a postback, since I never call btnGetSource_Click from within the code. If I
    > am misunderstanding your suggestion, could you try posting it? The code that you posted would not
    > let the user specify the URL, and it would only do one screenscrape. Thanks.
    > --
    > Nathan Sokalski
    >
    > http://www.nathansokalski.com/
    >
    > "Juan T. Llibre" <> wrote in message
    > news:uGz1Pf$...
    >> Nathan,
    >>
    >> have you tried checking for IsPostback in the Page_Load event ?
    >>
    >> i.e., let the code run if it's *not* a Postback and if it *is* a Postback, not let it run.
    >>
    >> Sub Page_Load
    >>
    >> If Not IsPostBack
    >> ' your screen scrape code
    >>
    >> End If
    >> End Sub
    >>
    >>
    >>
    >> Juan T. Llibre, asp.net MVP
    >> asp.net faq : http://asp.net.do/faq/
    >> foros de asp.net, en español : http://asp.net.do/foros/
    >> ===================================
    >> "Nathan Sokalski" <> wrote in message
    >> news:O3gCfM%...
    >>>I am recieving the following error on the second postback of a page I have written:
    >>>
    >>>
    >>> The state information is invalid for this page and might be corrupted
    >>>
    >>> Stack Trace:
    >>>
    >>> [FormatException: Invalid character in a Base-64 string.]
    >>> System.Convert.FromBase64String(String s) +0
    >>> System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72
    >>>
    >>> System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String
    >>> serializedState) +4
    >>> System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState)
    >>> +37
    >>> System.Web.UI.HiddenFieldPageStatePersister.Load() +140
    >>>
    >>> [ViewStateException: Invalid viewstate.
    >>> Client IP: 156.12.154.213
    >>> Port: 4212
    >>> User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR
    >>> 2.0.50727; .NET CLR 3.0.04506.30)
    >>> ViewState:
    >>> /wEPDwUKMTU5MTA2ODYwOWRkss85+lCwdpXAiRIXg3K0QPiFDCk=,/wEPDwUJNzM0NTM2OTI4ZGR70CFkynUOZFCdEqpCi5JMYQiXmw==
    >>> Referer: http://www.nathansokalski.com/screenscraper.aspx
    >>> Path: /screenscraper.aspx]
    >>>
    >>> [HttpException (0x80004005): The state information is invalid for this page and might be
    >>> corrupted.]
    >>> System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String
    >>> errorPageMessage, Boolean macValidationError) +116
    >>> System.Web.UI.HiddenFieldPageStatePersister.Load() +240
    >>> System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
    >>> System.Web.UI.Page.LoadAllState() +35
    >>> System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
    >>> includeStagesAfterAsyncPoint) +6953
    >>> System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean
    >>> includeStagesAfterAsyncPoint) +154
    >>> System.Web.UI.Page.ProcessRequest() +86
    >>> System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
    >>> System.Web.UI.Page.ProcessRequest(HttpContext context) +49
    >>> ASP.screenscraper_aspx.ProcessRequest(HttpContext context) +4
    >>>
    >>> System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
    >>> System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    >>> +64
    >>>
    >>>
    >>>
    >>> --------------------------------------------------------------------------------
    >>> Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
    >>> Version:2.0.50727.210
    >>>
    >>> The page is supposed to allow you to enter a URL and then display that page below the small form
    >>> that is in my code, which is as follows:
    >>>
    >>>
    >>> ScreenScraper.aspx:
    >>>
    >>> <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ScreenScraper.aspx.vb"
    >>> Inherits="WebApplication1.ScreenScraper" EnableViewState="false" %>
    >>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    >>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    >>> <html xmlns="http://www.w3.org/1999/xhtml" >
    >>> <head runat="server">
    >>> <title>ScreenScraper</title>
    >>> </head>
    >>> <body>
    >>> <form id="form1" runat="server">
    >>> <asp:TextBox ID="txtSourcePath" runat="server" Width="800px"/>
    >>> <asp:Button ID="btnGetSource" runat="server" Font-Bold="True" Text="Get Source"
    >>> Width="85px"/><br/><br/>
    >>> <asp:Label ID="lblSource" runat="server"/>
    >>> </form>
    >>> </body>
    >>> </html>
    >>>
    >>>
    >>> ScreenScraper.aspx.vb:
    >>>
    >>> Partial Public Class ScreenScraper : Inherits System.Web.UI.Page
    >>> Protected Sub btnGetSource_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    >>> Handles btnGetSource.Click
    >>> Dim source As New System.Net.WebClient()
    >>> Dim utf8 As New System.Text.UTF8Encoding()
    >>> lblSource.Text = utf8.GetString(source.DownloadData(txtSourcePath.Text))
    >>> End Sub
    >>> End Class
    >>>
    >>>
    >>> Most of the web pages I could find about this error said it was related to ViewState, but my
    >>> *.aspx file has EnableViewState="false" in the Page directive. My code works fine with every URL
    >>> I
    >>> have tried it with when it is the first URL I try, but the second one always gives me the error
    >>> shown above. I tried everything I could think of, but nothing seemed to help. Although it may
    >>> not
    >>> be sufficient for other applications or pages, for this page just having a way to make it act as
    >>> if it being opened for the first time would make it work (kind of like a reset or restart
    >>> command?). Thanks.
    >>> --
    >>> Nathan Sokalski
    >>>
    >>> http://www.nathansokalski.com/
     
    Juan T. Llibre, Dec 10, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski
    Replies:
    3
    Views:
    575
    Juan T. Llibre
    Dec 10, 2006
  2. Replies:
    0
    Views:
    511
  3. Replies:
    0
    Views:
    1,607
  4. Benny Ng
    Replies:
    2
    Views:
    1,609
    SureshKumar Ganapathy
    Oct 7, 2010
  5. Harish
    Replies:
    1
    Views:
    173
Loading...

Share This Page