473,614 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Response.Redire ct 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.redire ct 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 5377
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****@discuss ions.microsoft. com> wrote in message
news:E8******** *************** ***********@mic rosoft.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.redire ct 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.Redire ct("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****@discuss ions.microsoft. com> wrote in message
news:E8******** *************** ***********@mic rosoft.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.redire ct 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****@discuss ions.microsoft. com> wrote in message
news:DF******** *************** ***********@mic rosoft.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.Redire ct("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****@discuss ions.microsoft. com> wrote in message
news:E8******** *************** ***********@mic rosoft.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.redire ct 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****@discuss ions.microsoft. com> wrote in message
news:DF******** *************** ***********@mic rosoft.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.Redire ct("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****@discuss ions.microsoft. com> wrote in message
news:E8******** *************** ***********@mic rosoft.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.redire ct 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
11275
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" Src="WebControls/Header.ascx" %> The web user control contains the following server controls
2
4330
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 displaying the contents of the data source, whilst another control updates the datasource via a command buttons implementation of 'Click', an event raised in the 'Handle Postback Events' stage of the control execution life cycle (via the...
2
3054
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 why!!! Microsoft fix it!!!
5
7660
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 protected member 'System.Web.UI.Control.ViewState' via a qualifier of type 'System.Web.UI.Control'; the qualifier must be of type 'ASP.ItemOrderGrid' (or derived from it) Source Error:
5
2209
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 link buttons. Once I click the button, I would like to make it bold using instructions like linkbutton.font.bold=true This works as long as its NOT followed by response.redirect
3
4256
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
3856
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 be sent to page that was passed in teh Response.Redirect page. The AutoEventWireup is set to false on all pages. Any help would be greatly appreciated.
4
1798
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 parameter. When I call PopulateRepeater from the User Control page_load event it populates the repeater without a problem. When I call PopulateRepeater from a procedure in the web form which contains
1
2220
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 into catalog mode, and put the selected controls (ascx) into a webzone and viola, the controls are there, but the user control page_load thinks it's a postback. So I end up have to reload my databings on every postback. Does that make sense?...
0
8627
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8579
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8433
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6088
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5540
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4052
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1425
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.