Response.Redirect from User Control Page_Load

Discussion in 'ASP .Net' started by =?Utf-8?B?TWFydHkgVS4=?=, Dec 10, 2004.

  1. I have a Session variable I need to check the value of. If it is value a then
    redirect to some page. I need to implement this in a user control that is on
    all the relevent pages.

    I placed the if and redirect statement within the page_load of the user
    control. However, when you try to access any page that has the user control
    it simply loads for minutes and never actually redirects.

    What am I missing with executing the response.redirect from a user control's
    page_load event? The user control is a simple table and a few public
    properties that build a page header.

    Should I be placing this code somewhere else. I thought about writing a base
    class for the page object and overriding one of the events to see if it
    eleviates the problem.

    Any ideas and suggestions appreciated in advance.

    Marty U.
    =?Utf-8?B?TWFydHkgVS4=?=, Dec 10, 2004
    #1
    1. Advertising

  2. Have you checked the spelling of the URL you're redirecting to?

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Neither a follower
    nor a lender be.

    "Marty U." <> wrote in message
    news:...
    > I have a Session variable I need to check the value of. If it is value a

    then
    > redirect to some page. I need to implement this in a user control that is

    on
    > all the relevent pages.
    >
    > I placed the if and redirect statement within the page_load of the user
    > control. However, when you try to access any page that has the user

    control
    > it simply loads for minutes and never actually redirects.
    >
    > What am I missing with executing the response.redirect from a user

    control's
    > page_load event? The user control is a simple table and a few public
    > properties that build a page header.
    >
    > Should I be placing this code somewhere else. I thought about writing a

    base
    > class for the page object and overriding one of the events to see if it
    > eleviates the problem.
    >
    > Any ideas and suggestions appreciated in advance.
    >
    > Marty U.
    Kevin Spencer, Dec 10, 2004
    #2
    1. Advertising

  3. I am really getting tired since I have been programming since 6 a.m. EST.
    However, I did do some further tests. First I wrote an assembly and executing
    the object from there.

    Same result. Upon your message I figured I would try things once again.

    So I started trying different url formats and actually got a different result.

    Response.Redirect("mypage.aspx"); //Simply appears to timeout
    " ("/mypage.aspx"); //not found--site root--not app
    root
    " ("/appname/mypage.aspx"); //same as first
    " ("~/mypage.aspx"); //same as first
    " ("./mypage.aspx"); //same as first

    I maybe just too tired to focus but why will this not work? This is in the
    page_load of a user control that is placed after the form tag in each of the
    pages in the application. Response.Write works fine so something with the
    redirect method is causing the problem.

    Thanks

    "Kevin Spencer" wrote:

    > Have you checked the spelling of the URL you're redirecting to?
    >
    > --
    > HTH,
    > Kevin Spencer
    > ..Net Developer
    > Microsoft MVP
    > Neither a follower
    > nor a lender be.
    >
    > "Marty U." <> wrote in message
    > news:...
    > > I have a Session variable I need to check the value of. If it is value a

    > then
    > > redirect to some page. I need to implement this in a user control that is

    > on
    > > all the relevent pages.
    > >
    > > I placed the if and redirect statement within the page_load of the user
    > > control. However, when you try to access any page that has the user

    > control
    > > it simply loads for minutes and never actually redirects.
    > >
    > > What am I missing with executing the response.redirect from a user

    > control's
    > > page_load event? The user control is a simple table and a few public
    > > properties that build a page header.
    > >
    > > Should I be placing this code somewhere else. I thought about writing a

    > base
    > > class for the page object and overriding one of the events to see if it
    > > eleviates the problem.
    > >
    > > Any ideas and suggestions appreciated in advance.
    > >
    > > Marty U.

    >
    >
    >
    =?Utf-8?B?TWFydHkgVS4=?=, Dec 10, 2004
    #3
  4. Are you sure there isn't a problem with the page you're trying to redirect
    to? It sounds like it's processing, and never finishing.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Neither a follower
    nor a lender be.

    "Marty U." <> wrote in message
    news:D...
    > I am really getting tired since I have been programming since 6 a.m. EST.
    > However, I did do some further tests. First I wrote an assembly and

    executing
    > the object from there.
    >
    > Same result. Upon your message I figured I would try things once again.
    >
    > So I started trying different url formats and actually got a different

    result.
    >
    > Response.Redirect("mypage.aspx"); //Simply appears to timeout
    > " ("/mypage.aspx"); //not found--site root--not

    app
    > root
    > " ("/appname/mypage.aspx"); //same as first
    > " ("~/mypage.aspx"); //same as first
    > " ("./mypage.aspx"); //same as first
    >
    > I maybe just too tired to focus but why will this not work? This is in the
    > page_load of a user control that is placed after the form tag in each of

    the
    > pages in the application. Response.Write works fine so something with the
    > redirect method is causing the problem.
    >
    > Thanks
    >
    > "Kevin Spencer" wrote:
    >
    > > Have you checked the spelling of the URL you're redirecting to?
    > >
    > > --
    > > HTH,
    > > Kevin Spencer
    > > ..Net Developer
    > > Microsoft MVP
    > > Neither a follower
    > > nor a lender be.
    > >
    > > "Marty U." <> wrote in message
    > > news:...
    > > > I have a Session variable I need to check the value of. If it is value

    a
    > > then
    > > > redirect to some page. I need to implement this in a user control that

    is
    > > on
    > > > all the relevent pages.
    > > >
    > > > I placed the if and redirect statement within the page_load of the

    user
    > > > control. However, when you try to access any page that has the user

    > > control
    > > > it simply loads for minutes and never actually redirects.
    > > >
    > > > What am I missing with executing the response.redirect from a user

    > > control's
    > > > page_load event? The user control is a simple table and a few public
    > > > properties that build a page header.
    > > >
    > > > Should I be placing this code somewhere else. I thought about writing

    a
    > > base
    > > > class for the page object and overriding one of the events to see if

    it
    > > > eleviates the problem.
    > > >
    > > > Any ideas and suggestions appreciated in advance.
    > > >
    > > > Marty U.

    > >
    > >
    > >
    Kevin Spencer, Dec 10, 2004
    #4
  5. As I started to write this I discovered that the same user control is being
    used on the page I am redirecting to so guess what? It just keeps redirecting
    to itself.

    Wow, I have spent way too much time on something so simple.

    Thanks for the input.

    "Kevin Spencer" wrote:

    > Are you sure there isn't a problem with the page you're trying to redirect
    > to? It sounds like it's processing, and never finishing.
    >
    > --
    > HTH,
    > Kevin Spencer
    > ..Net Developer
    > Microsoft MVP
    > Neither a follower
    > nor a lender be.
    >
    > "Marty U." <> wrote in message
    > news:D...
    > > I am really getting tired since I have been programming since 6 a.m. EST.
    > > However, I did do some further tests. First I wrote an assembly and

    > executing
    > > the object from there.
    > >
    > > Same result. Upon your message I figured I would try things once again.
    > >
    > > So I started trying different url formats and actually got a different

    > result.
    > >
    > > Response.Redirect("mypage.aspx"); //Simply appears to timeout
    > > " ("/mypage.aspx"); //not found--site root--not

    > app
    > > root
    > > " ("/appname/mypage.aspx"); //same as first
    > > " ("~/mypage.aspx"); //same as first
    > > " ("./mypage.aspx"); //same as first
    > >
    > > I maybe just too tired to focus but why will this not work? This is in the
    > > page_load of a user control that is placed after the form tag in each of

    > the
    > > pages in the application. Response.Write works fine so something with the
    > > redirect method is causing the problem.
    > >
    > > Thanks
    > >
    > > "Kevin Spencer" wrote:
    > >
    > > > Have you checked the spelling of the URL you're redirecting to?
    > > >
    > > > --
    > > > HTH,
    > > > Kevin Spencer
    > > > ..Net Developer
    > > > Microsoft MVP
    > > > Neither a follower
    > > > nor a lender be.
    > > >
    > > > "Marty U." <> wrote in message
    > > > news:...
    > > > > I have a Session variable I need to check the value of. If it is value

    > a
    > > > then
    > > > > redirect to some page. I need to implement this in a user control that

    > is
    > > > on
    > > > > all the relevent pages.
    > > > >
    > > > > I placed the if and redirect statement within the page_load of the

    > user
    > > > > control. However, when you try to access any page that has the user
    > > > control
    > > > > it simply loads for minutes and never actually redirects.
    > > > >
    > > > > What am I missing with executing the response.redirect from a user
    > > > control's
    > > > > page_load event? The user control is a simple table and a few public
    > > > > properties that build a page header.
    > > > >
    > > > > Should I be placing this code somewhere else. I thought about writing

    > a
    > > > base
    > > > > class for the page object and overriding one of the events to see if

    > it
    > > > > eleviates the problem.
    > > > >
    > > > > Any ideas and suggestions appreciated in advance.
    > > > >
    > > > > Marty U.
    > > >
    > > >
    > > >

    >
    >
    >
    =?Utf-8?B?TWFydHkgVS4=?=, Dec 10, 2004
    #5
    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. =?Utf-8?B?VHJveQ==?=

    Response.redirect does not redirect from .aspx page

    =?Utf-8?B?VHJveQ==?=, Oct 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,233
    Srowe1975
    Oct 15, 2008
  2. Replies:
    4
    Views:
    3,912
  3. Fabrizio
    Replies:
    5
    Views:
    233
    Alessandro Zifiglio
    Feb 24, 2004
  4. Sal
    Replies:
    1
    Views:
    403
  5. Ron Howard
    Replies:
    2
    Views:
    516
    Ron Howard
    Aug 11, 2004
Loading...

Share This Page