473,498 Members | 1,704 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Response.Redirect from User Control Page_Load

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.
Nov 19 '05 #1
4 5371
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." <Ma****@discussions.microsoft.com> wrote in message
news:E8**********************************@microsof t.com...
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.

Nov 19 '05 #2
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." <Ma****@discussions.microsoft.com> wrote in message
news:E8**********************************@microsof t.com...
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.


Nov 19 '05 #3
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." <Ma****@discussions.microsoft.com> wrote in message
news:DF**********************************@microsof t.com...
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." <Ma****@discussions.microsoft.com> wrote in message
news:E8**********************************@microsof t.com...
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.


Nov 19 '05 #4
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." <Ma****@discussions.microsoft.com> wrote in message
news:DF**********************************@microsof t.com...
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." <Ma****@discussions.microsoft.com> wrote in message
news:E8**********************************@microsof t.com...
> 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.


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
11264
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
2
4312
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
2
3043
by: magister | last post by:
Does smartnavigation on parent page make user controls page_load twice... Any fixes for this!!! Problem is when boss sees smartnavigation he likes but it causes lots of other bugs....why...
5
7642
by: Steve Richter | last post by:
In my user control I want to read the ViewState dictionary of the Parent control. But this sensible idea is not permitted by the compiler: Compiler Error Message: CS1540: Cannot access...
5
2200
by: Trisha | last post by:
I have a navigation user control navig.ascx that redirects to respective pages based on webcontrols.linkbutton clicks using response.redirect. I would like to control the look and feel of those...
3
4246
by: thomasamillergoogle | last post by:
Is it possible that my user control can add code to the HEAD of the parent page that hosts the control?
6
3843
by: dwclark | last post by:
I am having an issue when I trigger a Response.Redirect, the Page_Load fires on the page where the Response.Redirect was called. From what I've read, this should not happen and the browser should...
4
1776
by: bill | last post by:
I have a Repeater control in a web user control. The web user control has a public method named PopulateRepeater which takes an ID as an parameter and populates the repeater control based on the...
1
2213
by: ryan.mclean | last post by:
Hello all, Here is my problem: I made a simple web project that uses they new webparts. On my page, I have a DeclarativeCatalogPart that contains references to several ascx files. I put my page...
0
7002
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7205
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6887
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5462
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4910
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4590
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.