Having a problem using WebRequest inside code invoked by the Page_Load event to to download a page l

Discussion in 'ASP .Net' started by Hasani \(remove nospam from address\), Sep 29, 2004.

  1. I have a website with 2 aspx pages
    Foo.aspx, and bar.aspx
    The content of both files
    is

    //in 1 file
    Hello <%=Session["Name"].ToString()%>


    ================
    Here's the problem, inside the Page_Load for
    Foo.aspx, using the HttpWebRequest, I do a request
    to bar.aspx, passing in the session cookie. A timeout occurs.
    When I use a debugger and set a break point at bar.aspx's Page_Load,
    the breakpoint is reached only after the HttpWebRequest throws a timeout
    exception inside Foo.aspx's Page_Load. Setting the timeout to higher numbers
    has no effect. Creating a webrequest to a page not on the same server as
    mine does not generate an error. e.x.: downloading cnn.com's homepage from
    within Foo.aspx will work. Does anyone know why this would happen. Please
    post back if any clarification is needed.
    I feel it may have something to do with the thread process used by iis
    and/or aspnet.

    It's sort of like the problem that's reported here ->
    http://groups.google.com/groups?hl=...8.38078$



    I'm using winxp pro w/ .net 1.1 and vs.net 2003. Everything .net related
    should be running in debug mode.
    Hasani \(remove nospam from address\), Sep 29, 2004
    #1
    1. Advertising

  2. You should probably use Server.Transfer() to transfer control from foo.aspx
    to bar.aspx.


    --
    Girish Bharadwaj
    http://msmvps.com/gbvb
    "Hasani (remove nospam from address)" <> wrote
    in message news:...
    > I have a website with 2 aspx pages
    > Foo.aspx, and bar.aspx
    > The content of both files
    > is
    >
    > //in 1 file
    > Hello <%=Session["Name"].ToString()%>
    >
    >
    > ================
    > Here's the problem, inside the Page_Load for
    > Foo.aspx, using the HttpWebRequest, I do a request
    > to bar.aspx, passing in the session cookie. A timeout occurs.
    > When I use a debugger and set a break point at bar.aspx's Page_Load,
    > the breakpoint is reached only after the HttpWebRequest throws a timeout
    > exception inside Foo.aspx's Page_Load. Setting the timeout to higher

    numbers
    > has no effect. Creating a webrequest to a page not on the same server as
    > mine does not generate an error. e.x.: downloading cnn.com's homepage from
    > within Foo.aspx will work. Does anyone know why this would happen. Please
    > post back if any clarification is needed.
    > I feel it may have something to do with the thread process used by iis
    > and/or aspnet.
    >
    > It's sort of like the problem that's reported here ->
    >

    http://groups.google.com/groups?hl=...8.38078$
    >
    >
    >
    > I'm using winxp pro w/ .net 1.1 and vs.net 2003. Everything .net related
    > should be running in debug mode.
    >
    >
    Girish Bharadwaj, Sep 29, 2004
    #2
    1. Advertising

  3. I can't because I want to download the rendered page (bar.aspx from inside
    foo.aspx).

    "Girish Bharadwaj" <> wrote in message
    news:...
    > You should probably use Server.Transfer() to transfer control from
    > foo.aspx
    > to bar.aspx.
    >
    >
    > --
    > Girish Bharadwaj
    > http://msmvps.com/gbvb
    > "Hasani (remove nospam from address)" <>
    > wrote
    > in message news:...
    >> I have a website with 2 aspx pages
    >> Foo.aspx, and bar.aspx
    >> The content of both files
    >> is
    >>
    >> //in 1 file
    >> Hello <%=Session["Name"].ToString()%>
    >>
    >>
    >> ================
    >> Here's the problem, inside the Page_Load for
    >> Foo.aspx, using the HttpWebRequest, I do a request
    >> to bar.aspx, passing in the session cookie. A timeout occurs.
    >> When I use a debugger and set a break point at bar.aspx's Page_Load,
    >> the breakpoint is reached only after the HttpWebRequest throws a timeout
    >> exception inside Foo.aspx's Page_Load. Setting the timeout to higher

    > numbers
    >> has no effect. Creating a webrequest to a page not on the same server as
    >> mine does not generate an error. e.x.: downloading cnn.com's homepage
    >> from
    >> within Foo.aspx will work. Does anyone know why this would happen. Please
    >> post back if any clarification is needed.
    >> I feel it may have something to do with the thread process used by iis
    >> and/or aspnet.
    >>
    >> It's sort of like the problem that's reported here ->
    >>

    > http://groups.google.com/groups?hl=...8.38078$
    >>
    >>
    >>
    >> I'm using winxp pro w/ .net 1.1 and vs.net 2003. Everything .net related
    >> should be running in debug mode.
    >>
    >>

    >
    >
    Hasani \(remove nospam from address\), Sep 29, 2004
    #3
  4. Hasani \(remove nospam from address\)

    Hermit Dave Guest

    i have used WebClient to fetch a rendered page.
    I normally use
    http://www.domainname.com/pagename.aspx to open the webclient and then read
    the data.
    leave it to do the dns query and resolution.

    though with webclient i never had to bother with session cookies etc

    --

    Regards,

    Hermit Dave
    (http://hdave.blogspot.com)
    "Hasani (remove nospam from address)" <> wrote
    in message news:...
    >I have a website with 2 aspx pages
    > Foo.aspx, and bar.aspx
    > The content of both files
    > is
    >
    > //in 1 file
    > Hello <%=Session["Name"].ToString()%>
    >
    >
    > ================
    > Here's the problem, inside the Page_Load for
    > Foo.aspx, using the HttpWebRequest, I do a request
    > to bar.aspx, passing in the session cookie. A timeout occurs.
    > When I use a debugger and set a break point at bar.aspx's Page_Load,
    > the breakpoint is reached only after the HttpWebRequest throws a timeout
    > exception inside Foo.aspx's Page_Load. Setting the timeout to higher
    > numbers has no effect. Creating a webrequest to a page not on the same
    > server as mine does not generate an error. e.x.: downloading cnn.com's
    > homepage from within Foo.aspx will work. Does anyone know why this would
    > happen. Please post back if any clarification is needed.
    > I feel it may have something to do with the thread process used by iis
    > and/or aspnet.
    >
    > It's sort of like the problem that's reported here ->
    > http://groups.google.com/groups?hl=...8.38078$
    >
    >
    >
    > I'm using winxp pro w/ .net 1.1 and vs.net 2003. Everything .net related
    > should be running in debug mode.
    >
    Hermit Dave, Sep 29, 2004
    #4
  5. I would also like to add that, when in debugging
    If inside Foo.aspx, I say Thread.Sleep(); while Foo.aspx is sleeping, I open
    IE using and go to Bar.aspx and it hangs (as if IIS hasn't processed by
    request, and I think it's because Thread.SLeep() was being executed in
    Foo.aspx) which was called by a different browser window.

    interesting.. I'm going to check my iis settings. it's as if my iis server
    is single threaded.
    Hasani \(remove nospam from address\), Sep 29, 2004
    #5
  6. Hasani \(remove nospam from address\)

    bruce barker Guest

    IE uses a common process for http requests (by design to implement the
    limited connection rule), so that even if you use more than 1 browser
    instance, if your breakpoint blocks a request, all browsers are blocked.

    -- bruce (sqlwork.com)


    "Hasani (remove nospam from address)" <> wrote
    in message news:...
    > I would also like to add that, when in debugging
    > If inside Foo.aspx, I say Thread.Sleep(); while Foo.aspx is sleeping, I

    open
    > IE using and go to Bar.aspx and it hangs (as if IIS hasn't processed by
    > request, and I think it's because Thread.SLeep() was being executed in
    > Foo.aspx) which was called by a different browser window.
    >
    > interesting.. I'm going to check my iis settings. it's as if my iis server
    > is single threaded.
    >
    >
    bruce barker, Sep 29, 2004
    #6
  7. Running it without being attached from a debugger produces the same result.
    If I switch the application to cookiless where the session id is passed
    around through the url, it seems to work but unfortunately, I have to store
    the session id in cookies.
    "bruce barker" <> wrote in message
    news:...
    > IE uses a common process for http requests (by design to implement the
    > limited connection rule), so that even if you use more than 1 browser
    > instance, if your breakpoint blocks a request, all browsers are blocked.
    >
    > -- bruce (sqlwork.com)
    >
    >
    > "Hasani (remove nospam from address)" <>
    > wrote
    > in message news:...
    >> I would also like to add that, when in debugging
    >> If inside Foo.aspx, I say Thread.Sleep(); while Foo.aspx is sleeping, I

    > open
    >> IE using and go to Bar.aspx and it hangs (as if IIS hasn't processed by
    >> request, and I think it's because Thread.SLeep() was being executed in
    >> Foo.aspx) which was called by a different browser window.
    >>
    >> interesting.. I'm going to check my iis settings. it's as if my iis
    >> server
    >> is single threaded.
    >>
    >>

    >
    >
    Hasani \(remove nospam from address\), Sep 29, 2004
    #7
  8. Case closed -- HttpServerUtility.Execute Method (String, TextWriter)

    http://msdn.microsoft.com/library/d...temwebhttpserverutilityclassexecutetopic2.asp

    I thank everyone for their input and timely response.

    "Hasani (remove nospam from address)" <> wrote
    in message news:...
    >I have a website with 2 aspx pages
    > Foo.aspx, and bar.aspx
    > The content of both files
    > is
    >
    > //in 1 file
    > Hello <%=Session["Name"].ToString()%>
    >
    >
    > ================
    > Here's the problem, inside the Page_Load for
    > Foo.aspx, using the HttpWebRequest, I do a request
    > to bar.aspx, passing in the session cookie. A timeout occurs.
    > When I use a debugger and set a break point at bar.aspx's Page_Load,
    > the breakpoint is reached only after the HttpWebRequest throws a timeout
    > exception inside Foo.aspx's Page_Load. Setting the timeout to higher
    > numbers has no effect. Creating a webrequest to a page not on the same
    > server as mine does not generate an error. e.x.: downloading cnn.com's
    > homepage from within Foo.aspx will work. Does anyone know why this would
    > happen. Please post back if any clarification is needed.
    > I feel it may have something to do with the thread process used by iis
    > and/or aspnet.
    >
    > It's sort of like the problem that's reported here ->
    > http://groups.google.com/groups?hl=...8.38078$
    >
    >
    >
    > I'm using winxp pro w/ .net 1.1 and vs.net 2003. Everything .net related
    > should be running in debug mode.
    >
    Hasani \(remove nospam from address\), Sep 29, 2004
    #8
  9. Hasani \(remove nospam from address\)

    bruce barker Guest

    if you use webclient, your code is responsible for sending any cookies.

    -- bruce (sqlwork.com)


    "Hasani (remove nospam from address)" <> wrote
    in message news:...
    > Running it without being attached from a debugger produces the same

    result.
    > If I switch the application to cookiless where the session id is passed
    > around through the url, it seems to work but unfortunately, I have to

    store
    > the session id in cookies.
    > "bruce barker" <> wrote in message
    > news:...
    > > IE uses a common process for http requests (by design to implement the
    > > limited connection rule), so that even if you use more than 1 browser
    > > instance, if your breakpoint blocks a request, all browsers are blocked.
    > >
    > > -- bruce (sqlwork.com)
    > >
    > >
    > > "Hasani (remove nospam from address)" <>
    > > wrote
    > > in message news:...
    > >> I would also like to add that, when in debugging
    > >> If inside Foo.aspx, I say Thread.Sleep(); while Foo.aspx is sleeping, I

    > > open
    > >> IE using and go to Bar.aspx and it hangs (as if IIS hasn't processed by
    > >> request, and I think it's because Thread.SLeep() was being executed in
    > >> Foo.aspx) which was called by a different browser window.
    > >>
    > >> interesting.. I'm going to check my iis settings. it's as if my iis
    > >> server
    > >> is single threaded.
    > >>
    > >>

    > >
    > >

    >
    >
    bruce barker, Sep 29, 2004
    #9
  10. Yes, I'm aware of this. I use a httpwebrequest object and copy cookies from
    the HttpRequest.Cookies object.
    "bruce barker" <> wrote in message
    news:...
    > if you use webclient, your code is responsible for sending any cookies.
    >
    > -- bruce (sqlwork.com)
    >
    >
    > "Hasani (remove nospam from address)" <>
    > wrote
    > in message news:...
    >> Running it without being attached from a debugger produces the same

    > result.
    >> If I switch the application to cookiless where the session id is passed
    >> around through the url, it seems to work but unfortunately, I have to

    > store
    >> the session id in cookies.
    >> "bruce barker" <> wrote in message
    >> news:...
    >> > IE uses a common process for http requests (by design to implement the
    >> > limited connection rule), so that even if you use more than 1 browser
    >> > instance, if your breakpoint blocks a request, all browsers are
    >> > blocked.
    >> >
    >> > -- bruce (sqlwork.com)
    >> >
    >> >
    >> > "Hasani (remove nospam from address)" <>
    >> > wrote
    >> > in message news:...
    >> >> I would also like to add that, when in debugging
    >> >> If inside Foo.aspx, I say Thread.Sleep(); while Foo.aspx is sleeping,
    >> >> I
    >> > open
    >> >> IE using and go to Bar.aspx and it hangs (as if IIS hasn't processed
    >> >> by
    >> >> request, and I think it's because Thread.SLeep() was being executed in
    >> >> Foo.aspx) which was called by a different browser window.
    >> >>
    >> >> interesting.. I'm going to check my iis settings. it's as if my iis
    >> >> server
    >> >> is single threaded.
    >> >>
    >> >>
    >> >
    >> >

    >>
    >>

    >
    >
    Hasani \(remove nospam from address\), Sep 29, 2004
    #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. Stephen Miller
    Replies:
    5
    Views:
    9,134
    kaverao
    Sep 17, 2009
  2. RAJ

    PAGE_LOAD invoked twice

    RAJ, May 24, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    334
  3. RAJ

    PAGE_LOAD invoked twice

    RAJ, Jun 7, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    395
  4. rockdale
    Replies:
    1
    Views:
    656
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Nov 16, 2006
  5. Sunfire
    Replies:
    2
    Views:
    646
    Sunfire
    Nov 5, 2007
Loading...

Share This Page