Have any idea what might cause this HttpException error?

Discussion in 'ASP .Net' started by AAaron123, Jul 21, 2009.

  1. AAaron123

    AAaron123 Guest

    Have any idea what might cause this error?

    ---Page loads and I click a button and the following runs:

    Protected Sub ButtonDisplay_Click...
    Dim objRequest As WebRequest =
    System.Net.HttpWebRequest.Create(TextBox1.Text)
    objRequest.Method = WebRequestMethods.Http.Get
    Dim objResponse As WebResponse = objRequest.GetResponse()
    Dim sr As New StreamReader(objResponse.GetResponseStream())
    strResult = sr.ReadToEnd()
    objResponse.Close()
    sr.Close()
    ....

    ---I click the button again and the following happens:
    Page_PreInit1
    ---Runs
    End Sub
    Page_InitComplete
    ---Runs
    End sub
    ----Error Happens here----
    Page_PreLoad


    The state information is invalid for this page and might be corrupted.
    Description: An unhandled exception occurred during the execution of the
    current web request. Please review the stack trace for more information
    about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: The state information is
    invalid for this page and might be corrupted.


    ---TextBox1.Text points to my web site
    ---I'm running in the IDE vs 2008


    Thanks for any suggestions on how to track this down
     
    AAaron123, Jul 21, 2009
    #1
    1. Advertising

  2. AAaron123

    AAaron123 Guest

    AAaron123 wrote:
    > Have any idea what might cause this error?
    >
    > ---Page loads and I click a button and the following runs:
    >
    > Protected Sub ButtonDisplay_Click...
    > Dim objRequest As WebRequest =
    > System.Net.HttpWebRequest.Create(TextBox1.Text)
    > objRequest.Method = WebRequestMethods.Http.Get
    > Dim objResponse As WebResponse = objRequest.GetResponse()
    > Dim sr As New StreamReader(objResponse.GetResponseStream())
    > strResult = sr.ReadToEnd()
    > objResponse.Close()
    > sr.Close()
    > ...
    >
    > ---I click the button again and the following happens:
    > Page_PreInit1
    > ---Runs
    > End Sub
    > Page_InitComplete
    > ---Runs
    > End sub
    > ----Error Happens here----
    > Page_PreLoad
    >
    >
    > The state information is invalid for this page and might be corrupted.
    > Description: An unhandled exception occurred during the execution of
    > the current web request. Please review the stack trace for more
    > information about the error and where it originated in the code.
    >
    > Exception Details: System.Web.HttpException: The state information is
    > invalid for this page and might be corrupted.
    >
    >
    > ---TextBox1.Text points to my web site
    > ---I'm running in the IDE vs 2008
    >
    >
    > Thanks for any suggestions on how to track this down


    I don't know if this means anything to anybody but,

    If when the error page is showing I go back one page and click again I get
    the error again.

    But if I go back two pages and click it works OK but another click produces
    the error.

    That is, if I return to where I started it works as it did the first time.

    I thought that going back to a page things (like the cache) might be in a
    different state the mormnnly going to a page.

    I also tried it in firefox with the same error.
     
    AAaron123, Jul 21, 2009
    #2
    1. Advertising

  3. AAaron123

    Leon Guest

    On Tue, 21 Jul 2009 18:53:30 -0400, "AAaron123"
    <> wrote:

    >AAaron123 wrote:
    >> Have any idea what might cause this error?
    >>
    >> ---Page loads and I click a button and the following runs:
    >>
    >> Protected Sub ButtonDisplay_Click...
    >> Dim objRequest As WebRequest =
    >> System.Net.HttpWebRequest.Create(TextBox1.Text)
    >> objRequest.Method = WebRequestMethods.Http.Get
    >> Dim objResponse As WebResponse = objRequest.GetResponse()
    >> Dim sr As New StreamReader(objResponse.GetResponseStream())
    >> strResult = sr.ReadToEnd()
    >> objResponse.Close()
    >> sr.Close()
    >> ...
    >>
    >> ---I click the button again and the following happens:
    >> Page_PreInit1
    >> ---Runs
    >> End Sub
    >> Page_InitComplete
    >> ---Runs
    >> End sub
    >> ----Error Happens here----
    >> Page_PreLoad
    >>
    >>
    >> The state information is invalid for this page and might be corrupted.
    >> Description: An unhandled exception occurred during the execution of
    >> the current web request. Please review the stack trace for more
    >> information about the error and where it originated in the code.
    >>
    >> Exception Details: System.Web.HttpException: The state information is
    >> invalid for this page and might be corrupted.
    >>
    >>
    >> ---TextBox1.Text points to my web site
    >> ---I'm running in the IDE vs 2008
    >>
    >>
    >> Thanks for any suggestions on how to track this down

    >
    >I don't know if this means anything to anybody but,
    >
    >If when the error page is showing I go back one page and click again I get
    >the error again.
    >
    >But if I go back two pages and click it works OK but another click produces
    >the error.
    >
    >That is, if I return to where I started it works as it did the first time.
    >
    >I thought that going back to a page things (like the cache) might be in a
    >different state the mormnnly going to a page.
    >
    >I also tried it in firefox with the same error.
    >
    >
    >
    >
    >

    I don't know what you are trying to do in ButtonDisplay_Click, but
    altering the WebRequests and Responses from code isn't really "best
    practise" and can be rather tricky.
    I'd say, try to rewrite the function (or comment it) and try to run it
    again

    ..L.
     
    Leon, Jul 22, 2009
    #3
  4. AAaron123

    AAaron123 Guest

    Leon wrote:
    > On Tue, 21 Jul 2009 18:53:30 -0400, "AAaron123"
    > <> wrote:
    >
    >> AAaron123 wrote:
    >>> Have any idea what might cause this error?
    >>>
    >>> ---Page loads and I click a button and the following runs:
    >>>
    >>> Protected Sub ButtonDisplay_Click...
    >>> Dim objRequest As WebRequest =
    >>> System.Net.HttpWebRequest.Create(TextBox1.Text)
    >>> objRequest.Method = WebRequestMethods.Http.Get
    >>> Dim objResponse As WebResponse = objRequest.GetResponse()
    >>> Dim sr As New StreamReader(objResponse.GetResponseStream())
    >>> strResult = sr.ReadToEnd()
    >>> objResponse.Close()
    >>> sr.Close()
    >>> ...
    >>>
    >>> ---I click the button again and the following happens:
    >>> Page_PreInit1
    >>> ---Runs
    >>> End Sub
    >>> Page_InitComplete
    >>> ---Runs
    >>> End sub
    >>> ----Error Happens here----
    >>> Page_PreLoad
    >>>
    >>>
    >>> The state information is invalid for this page and might be
    >>> corrupted. Description: An unhandled exception occurred during the
    >>> execution of the current web request. Please review the stack trace
    >>> for more information about the error and where it originated in the
    >>> code.
    >>>
    >>> Exception Details: System.Web.HttpException: The state information
    >>> is invalid for this page and might be corrupted.
    >>>
    >>>
    >>> ---TextBox1.Text points to my web site
    >>> ---I'm running in the IDE vs 2008
    >>>
    >>>
    >>> Thanks for any suggestions on how to track this down

    >>
    >> I don't know if this means anything to anybody but,
    >>
    >> If when the error page is showing I go back one page and click again
    >> I get the error again.
    >>
    >> But if I go back two pages and click it works OK but another click
    >> produces the error.
    >>
    >> That is, if I return to where I started it works as it did the first
    >> time.
    >>
    >> I thought that going back to a page things (like the cache) might be
    >> in a different state the mormnnly going to a page.
    >>
    >> I also tried it in firefox with the same error.
    >>
    >>
    >>
    >>
    >>

    > I don't know what you are trying to do in ButtonDisplay_Click, but
    > altering the WebRequests and Responses from code isn't really "best
    > practise" and can be rather tricky.
    > I'd say, try to rewrite the function (or comment it) and try to run it
    > again
    >
    > .L.


    It's definetly due to that code.
    All I'm doing is getting a copy of the html that my site sends, and
    displaying it.

    thanks


    Here is the entire error.
    I noticed the version at the end shows as 2.0 rather than 3.5
    Who's framework is it refering to, me or the server?
    Probably no one knows how to solve this because there are over 6000 google
    hits with no answer that I could find.
    I just wish I knew what the error means!
    I.e., what data is in the "State Information"


    Thanls



    Server Error in '/St. Louis Gonzaga' Application.
    --------------------------------------------------------------------------------

    The state information is invalid for this page and might be corrupted.
    Description: An unhandled exception occurred during the execution of the
    current web request. Please review the stack trace for more information
    about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: The state information is
    invalid for this page and might be corrupted.

    Source Error:

    The source code that generated this unhandled exception can only be
    shown when compiled in debug mode. To enable this, please follow one of the
    below steps, then request the URL:

    1. Add a "Debug=true" directive at the top of the file that generated
    the error. Example:

    <%@ Page Language="C#" Debug="true" %>

    or:

    2) Add the following section to the configuration file of your
    application:

    <configuration>
    <system.web>
    <compilation debug="true"/>
    </system.web>
    </configuration>

    Note that this second technique will cause all files within a given
    application to be compiled in debug mode. The first technique will cause
    only that particular file to be compiled in debug mode.

    Important: Running applications in debug mode does incur a
    memory/performance overhead. You should make sure that an application has
    debugging disabled before deploying into production scenario.

    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() +113

    [ViewStateException: Invalid viewstate.
    Client IP: 127.0.0.1
    Port:
    User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0;
    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; .NET CLR 3.0.04506.648; .NET CLR
    3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729;
    OfficeLiveConnector.1.4; OfficeLivePatch.1.3; msn OptimizedIE8;ENUS)
    ViewState:
    /wEPDwUKMTY2MDY1NTE2Ng8WAh4IQmVlbkhlcmVnFgJmD2QWBAIBD2QWAgIBDxYCHgRocmVmBRVTdHlsZVNoZWV0cy9CbGFjay5jc3NkAgMPZBYCAgEPZBYOAgMPEA8WAh4HQ2hlY2tlZGdkZGRkAgUPEA8WAh8CaGRkZGQCBw8QDxYCHwJoZGRkZAIJDxAPFgIfAmhkZGRkAgsPEA8WAh8CaGRkZGQCEQ88KwANAgAPFgIeC18hRGF0YUJvdW5kZ2QMFCsAAgUDMDowFCsAAhYQHgRUZXh0BQRIb21lHgVWYWx1ZQUESG9tZR4LTmF2aWdhdGVVcmwFHy9TdC4gTG91aXMgR29uemFnYS9EZWZhdWx0LmFzcHgeB1Rvb2xUaXAFFkdvIHRvIHRoZSBUaGVIb21lIFBhZ2UeB0VuYWJsZWRnHgpTZWxlY3RhYmxlZx4IRGF0YVBhdGgFHy9zdC4gbG91aXMgZ29uemFnYS9kZWZhdWx0LmFzcHgeCURhdGFCb3VuZGcUKwAOBTYwOjAsMDoxLDA6MiwwOjMsMDo0LDA6NSwwOjYsMDo3LDA6OCwwOjksMDoxMCwwOjExLDA6MTIUKwACFhAfBAUFQWRt...]

    [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) +106
    System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner,
    String persistedState) +14
    System.Web.UI.HiddenFieldPageStatePersister.Load() +217
    System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +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(HttpContext context) +21
    System.Web.UI.Page.ProcessRequest(HttpContext context) +49
    ASP.admin_screenscraping_aspx.ProcessRequest(HttpContext context) +37
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    +181
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
    completedSynchronously) +75



    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.3082;
    ASP.NET Version:2.0.50727.4028
     
    AAaron123, Jul 22, 2009
    #4
  5. AAaron123

    Leon Guest

    On Wed, 22 Jul 2009 07:50:38 -0400, "AAaron123"
    <> wrote:

    >Leon wrote:
    >> On Tue, 21 Jul 2009 18:53:30 -0400, "AAaron123"
    >> <> wrote:
    >>
    >>> AAaron123 wrote:
    >>>> Have any idea what might cause this error?
    >>>>

    [SNIP]
    >>>
    >>>
    >>>

    >> I don't know what you are trying to do in ButtonDisplay_Click, but
    >> altering the WebRequests and Responses from code isn't really "best
    >> practise" and can be rather tricky.
    >> I'd say, try to rewrite the function (or comment it) and try to run it
    >> again
    >>
    >> .L.

    >
    >It's definetly due to that code.
    >All I'm doing is getting a copy of the html that my site sends, and
    >displaying it.
    >
    >thanks
    >
    >
    >Here is the entire error.
    >I noticed the version at the end shows as 2.0 rather than 3.5
    >Who's framework is it refering to, me or the server?
    >Probably no one knows how to solve this because there are over 6000 google
    >hits with no answer that I could find.
    >I just wish I knew what the error means!
    >I.e., what data is in the "State Information"
    >

    [SNIP]
    >--------------------------------------------------------------------------------
    >Version Information: Microsoft .NET Framework Version:2.0.50727.3082;
    >ASP.NET Version:2.0.50727.4028


    IIS is running in ASP 2.0, so that could be the case althought you're
    extremely lucky if you are ^^ (wont bet on it)

    The State information is the Viewstate. You'll get the same error when
    your session is long dead and gone and you resend the page or when you
    alter the viewstate before posting it back to the server.

    If I'm right you want to get the HTML posted to the client on that
    button_click, right? Why would you want that?
    (just to make sure I'm getting it...)

    ..L.
     
    Leon, Jul 22, 2009
    #5
  6. AAaron123

    AAaron123 Guest

    Leon wrote:
    > On Wed, 22 Jul 2009 07:50:38 -0400, "AAaron123"
    > <> wrote:
    >
    >> Leon wrote:
    >>> On Tue, 21 Jul 2009 18:53:30 -0400, "AAaron123"
    >>> <> wrote:
    >>>
    >>>> AAaron123 wrote:
    >>>>> Have any idea what might cause this error?
    >>>>>

    > [SNIP]
    >>>>
    >>>>
    >>>>
    >>> I don't know what you are trying to do in ButtonDisplay_Click, but
    >>> altering the WebRequests and Responses from code isn't really "best
    >>> practise" and can be rather tricky.
    >>> I'd say, try to rewrite the function (or comment it) and try to run
    >>> it again
    >>>
    >>> .L.

    >>
    >> It's definetly due to that code.
    >> All I'm doing is getting a copy of the html that my site sends, and
    >> displaying it.
    >>
    >> thanks
    >>
    >>
    >> Here is the entire error.
    >> I noticed the version at the end shows as 2.0 rather than 3.5
    >> Who's framework is it refering to, me or the server?
    >> Probably no one knows how to solve this because there are over 6000
    >> google hits with no answer that I could find.
    >> I just wish I knew what the error means!
    >> I.e., what data is in the "State Information"
    >>

    > [SNIP]
    >> --------------------------------------------------------------------------------
    >> Version Information: Microsoft .NET Framework Version:2.0.50727.3082;
    >> ASP.NET Version:2.0.50727.4028

    >
    > IIS is running in ASP 2.0, so that could be the case althought you're
    > extremely lucky if you are ^^ (wont bet on it)


    Why do you say that? Is ASP.NET2.0 unusual on a host IIS?

    What does this mean: (wont bet on it)?
    Isn't it obvious that my host's IIS is running in ASP 2.0?


    >
    > The State information is the Viewstate. You'll get the same error when
    > your session is long dead and gone and you resend the page or when you
    > alter the viewstate before posting it back to the server.


    It's not the delay that is the problem here.

    >
    > If I'm right you want to get the HTML posted to the client on that
    > button_click, right? Why would you want that?
    > (just to make sure I'm getting it...)

    I'm learning and just wanted to try.
    I know the browsers let you look at the source code but I wanted to see if I
    can get it.

    Now I want to know what the problem is!

    >
    > .L.


    It always works the first time I retrieve the HTML and always fails the
    second time I retrieve.

    Is it comparing the Viewstate of my retrieving post to the viewstate if my
    second post of the page?

    Thanks
     
    AAaron123, Jul 22, 2009
    #6
  7. AAaron123

    Leon Guest

    On Wed, 22 Jul 2009 09:25:29 -0400, "AAaron123"
    <> wrote:

    >Leon wrote:
    >> On Wed, 22 Jul 2009 07:50:38 -0400, "AAaron123"
    >> <> wrote:
    >>
    >>> Leon wrote:
    >>>> On Tue, 21 Jul 2009 18:53:30 -0400, "AAaron123"
    >>>> <> wrote:
    >>>>
    >>>>> AAaron123 wrote:
    >>>>>> Have any idea what might cause this error?
    >>>>>>

    >> [SNIP]
    >>>>>
    >>>>>
    >>>>>
    >>>> I don't know what you are trying to do in ButtonDisplay_Click, but
    >>>> altering the WebRequests and Responses from code isn't really "best
    >>>> practise" and can be rather tricky.
    >>>> I'd say, try to rewrite the function (or comment it) and try to run
    >>>> it again
    >>>>
    >>>> .L.
    >>>
    >>> It's definetly due to that code.
    >>> All I'm doing is getting a copy of the html that my site sends, and
    >>> displaying it.
    >>>
    >>> thanks
    >>>
    >>>
    >>> Here is the entire error.
    >>> I noticed the version at the end shows as 2.0 rather than 3.5
    >>> Who's framework is it refering to, me or the server?
    >>> Probably no one knows how to solve this because there are over 6000
    >>> google hits with no answer that I could find.
    >>> I just wish I knew what the error means!
    >>> I.e., what data is in the "State Information"
    >>>

    >> [SNIP]
    >>> --------------------------------------------------------------------------------
    >>> Version Information: Microsoft .NET Framework Version:2.0.50727.3082;
    >>> ASP.NET Version:2.0.50727.4028

    >>
    >> IIS is running in ASP 2.0, so that could be the case althought you're
    >> extremely lucky if you are ^^ (wont bet on it)

    >
    >Why do you say that? Is ASP.NET2.0 unusual on a host IIS?
    >
    >What does this mean: (wont bet on it)?
    >Isn't it obvious that my host's IIS is running in ASP 2.0?
    >


    Yes it is obvious that it's running 2.0, but if you want it to run in
    3.5 as a soltution > that's the thing I wont bet on..

    >
    >>
    >> The State information is the Viewstate. You'll get the same error when
    >> your session is long dead and gone and you resend the page or when you
    >> alter the viewstate before posting it back to the server.

    >
    >It's not the delay that is the problem here.
    >
    >>
    >> If I'm right you want to get the HTML posted to the client on that
    >> button_click, right? Why would you want that?
    >> (just to make sure I'm getting it...)

    >I'm learning and just wanted to try.
    >I know the browsers let you look at the source code but I wanted to see if I
    >can get it.
    >
    >Now I want to know what the problem is!
    >


    Looking at the beginning post - what do you do with the

    Dim objRequest As WebRequest =
    System.Net.HttpWebRequest.Create(TextBox1.Text) ?

    You create (by code) a new item?


    >>
    >> .L.

    >
    >It always works the first time I retrieve the HTML and always fails the
    >second time I retrieve.
    >
    >Is it comparing the Viewstate of my retrieving post to the viewstate if my
    >second post of the page?
    >
    >Thanks
    >
    >
    >


    ..L.
     
    Leon, Jul 22, 2009
    #7
  8. Check out this complete, working, example :

    http://authors.aspalliance.com/stevesmith/articles/netscrape.asp

    If you're using international characters, and not just ASCII ones, modify :

    Dim sr As New StreamReader(objResponse.GetResponseStream())

    to read :

    Dim sr As New StreamReader(objResponse.GetResponseStream(), System.Text.Encoding.UTF7)






    Juan T. Llibre, asp.net MVP
    ¿ Estas probando VS 2010 y ASP.NET 4.0 ?
    Regístrate (gratis) en los Foros de VS 2010 y ASP.NET 4.0, en español
    http://asp.net.do/foros/forums/
    =====================================================
    "AAaron123" <> wrote in message news:%...
    > Have any idea what might cause this error?
    >
    > ---Page loads and I click a button and the following runs:
    >
    > Protected Sub ButtonDisplay_Click...
    > Dim objRequest As WebRequest = System.Net.HttpWebRequest.Create(TextBox1.Text)
    > objRequest.Method = WebRequestMethods.Http.Get
    > Dim objResponse As WebResponse = objRequest.GetResponse()
    > Dim sr As New StreamReader(objResponse.GetResponseStream())
    > strResult = sr.ReadToEnd()
    > objResponse.Close()
    > sr.Close()
    > ...
    >
    > ---I click the button again and the following happens:
    > Page_PreInit1
    > ---Runs
    > End Sub
    > Page_InitComplete
    > ---Runs
    > End sub
    > ----Error Happens here----
    > Page_PreLoad
    >
    >
    > The state information is invalid for this page and might be corrupted.
    > Description: An unhandled exception occurred during the execution of the current web request. Please review the stack
    > trace for more information about the error and where it originated in the code.
    >
    > Exception Details: System.Web.HttpException: The state information is invalid for this page and might be corrupted.
    >
    >
    > ---TextBox1.Text points to my web site
    > ---I'm running in the IDE vs 2008
    >
    >
    > Thanks for any suggestions on how to track this down
    >
     
    Juan T. Llibre, Jul 22, 2009
    #8
  9. AAaron123

    AAaron123 Guest

    Leon wrote:
    > On Wed, 22 Jul 2009 09:25:29 -0400, "AAaron123"
    > <> wrote:
    >
    >> Leon wrote:
    >>> On Wed, 22 Jul 2009 07:50:38 -0400, "AAaron123"
    >>> <> wrote:
    >>>
    >>>> Leon wrote:
    >>>>> On Tue, 21 Jul 2009 18:53:30 -0400, "AAaron123"
    >>>>> <> wrote:
    >>>>>
    >>>>>> AAaron123 wrote:
    >>>>>>> Have any idea what might cause this error?
    >>>>>>>
    >>> [SNIP]
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>> I don't know what you are trying to do in ButtonDisplay_Click, but
    >>>>> altering the WebRequests and Responses from code isn't really
    >>>>> "best practise" and can be rather tricky.
    >>>>> I'd say, try to rewrite the function (or comment it) and try to
    >>>>> run it again
    >>>>>
    >>>>> .L.
    >>>>
    >>>> It's definetly due to that code.
    >>>> All I'm doing is getting a copy of the html that my site sends, and
    >>>> displaying it.
    >>>>
    >>>> thanks
    >>>>
    >>>>
    >>>> Here is the entire error.
    >>>> I noticed the version at the end shows as 2.0 rather than 3.5
    >>>> Who's framework is it refering to, me or the server?
    >>>> Probably no one knows how to solve this because there are over 6000
    >>>> google hits with no answer that I could find.
    >>>> I just wish I knew what the error means!
    >>>> I.e., what data is in the "State Information"
    >>>>
    >>> [SNIP]
    >>>> --------------------------------------------------------------------------------
    >>>> Version Information: Microsoft .NET Framework
    >>>> Version:2.0.50727.3082; ASP.NET Version:2.0.50727.4028
    >>>
    >>> IIS is running in ASP 2.0, so that could be the case althought
    >>> you're extremely lucky if you are ^^ (wont bet on it)

    >>
    >> Why do you say that? Is ASP.NET2.0 unusual on a host IIS?
    >>
    >> What does this mean: (wont bet on it)?
    >> Isn't it obvious that my host's IIS is running in ASP 2.0?
    >>

    >
    > Yes it is obvious that it's running 2.0, but if you want it to run in
    > 3.5 as a soltution > that's the thing I wont bet on..


    ASP.NET2.0 can run with Framework v2??


    >
    >>
    >>>
    >>> The State information is the Viewstate. You'll get the same error
    >>> when your session is long dead and gone and you resend the page or
    >>> when you alter the viewstate before posting it back to the server.

    >>
    >> It's not the delay that is the problem here.
    >>
    >>>
    >>> If I'm right you want to get the HTML posted to the client on that
    >>> button_click, right? Why would you want that?
    >>> (just to make sure I'm getting it...)

    >> I'm learning and just wanted to try.
    >> I know the browsers let you look at the source code but I wanted to
    >> see if I can get it.
    >>
    >> Now I want to know what the problem is!
    >>

    >
    > Looking at the beginning post - what do you do with the
    >
    > Dim objRequest As WebRequest =
    > System.Net.HttpWebRequest.Create(TextBox1.Text) ?
    >
    > You create (by code) a new item?


    create a WebRequest object (giving the URL)
    I have to check to see if it should be a HTTPWebRequest object

    >
    >
    >>>
    >>> .L.

    >>
    >> It always works the first time I retrieve the HTML and always fails
    >> the second time I retrieve.
    >>
    >> Is it comparing the Viewstate of my retrieving post to the viewstate
    >> if my second post of the page?
    >>
    >> Thanks
    >>
    >>
    >>

    >
    > .L.
     
    AAaron123, Jul 22, 2009
    #9
  10. AAaron123

    AAaron123 Guest

    I had to put the code he had in page_load, into a button event handler so I
    could call it twice.
    Got the same error the second time.

    I used his vb script but in his C# script below:
    -Shouldn't he be closing objResponse?
    -Doesn't "using" close sr (i.e., he does need to) ?

    void Page_Load(Object Src, EventArgs E) {
    myPage.Text = readHtmlPage(http://aspadvice.com/blogs/ssmith/);
    }
    private String readHtmlPage(string url)
    {
    String result;
    WebResponse objResponse;
    WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
    objResponse = objRequest.GetResponse();
    using (StreamReader sr =
    new StreamReader(objResponse.GetResponseStream()) )
    {
    result = sr.ReadToEnd();
    // Close and clean up the StreamReader
    sr.Close();
    }
    return result;
    }

    Thanks

    Juan T. Llibre wrote:
    > Check out this complete, working, example :
    >
    > http://authors.aspalliance.com/stevesmith/articles/netscrape.asp
    >
    > If you're using international characters, and not just ASCII ones,
    > modify :
    > Dim sr As New StreamReader(objResponse.GetResponseStream())
    >
    > to read :
    >
    > Dim sr As New StreamReader(objResponse.GetResponseStream(),
    > System.Text.Encoding.UTF7)
    >
    >
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > ¿ Estas probando VS 2010 y ASP.NET 4.0 ?
    > Regístrate (gratis) en los Foros de VS 2010 y ASP.NET 4.0, en español
    > http://asp.net.do/foros/forums/
     
    AAaron123, Jul 22, 2009
    #10
    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. Steve
    Replies:
    0
    Views:
    5,361
    Steve
    Jul 1, 2003
  2. Gvnn
    Replies:
    2
    Views:
    1,250
    Saravana [MVP]
    Oct 18, 2003
  3. Nicolas LeBlanc
    Replies:
    2
    Views:
    2,567
    Nicolas LeBlanc
    Feb 19, 2004
  4. Tony Johansson

    An application that might cause problem

    Tony Johansson, Apr 21, 2005, in forum: C++
    Replies:
    5
    Views:
    344
    Jesper Madsen
    Apr 28, 2005
  5. Dr Mephesto

    App idea, Any idea on implementation?

    Dr Mephesto, Feb 4, 2008, in forum: Python
    Replies:
    3
    Views:
    730
    Dennis Lee Bieber
    Feb 5, 2008
Loading...

Share This Page