473,473 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to redirect from global.asax

Hi,

When my web application starts I want to create some instances, if an
exception is raisen I want to show a specific page instead of the main page.
How can I transfer the execution to a new page?

using Server.Transfer doesn't work cause I don't have a page yet.

Thanks in advance

--
Salvador Alvarez Patuel
Exony Ltd - London, UK
Nov 19 '05 #1
3 2877
Hi,
Handle the application error in the Application_Error event.
Add the following code
this.Context.Response.Write(@"<script language='javascript'>window.parent.location.href = '" + <Page to redirect> + "'</script>");

Regards,

Sambath

"Salvador" <Sa******@discussions.microsoft.com> wrote in message news:3E**********************************@microsof t.com...
Hi,

When my web application starts I want to create some instances, if an
exception is raisen I want to show a specific page instead of the main page.
How can I transfer the execution to a new page?

using Server.Transfer doesn't work cause I don't have a page yet.

Thanks in advance

--
Salvador Alvarez Patuel
Exony Ltd - London, UK

Nov 19 '05 #2
I use System.Web.HttpContext.Current.Response.Redirect(" new page.aspx" );

bill

"Salvador" <Sa******@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
Hi,

When my web application starts I want to create some instances, if an
exception is raisen I want to show a specific page instead of the main page. How can I transfer the execution to a new page?

using Server.Transfer doesn't work cause I don't have a page yet.

Thanks in advance

--
Salvador Alvarez Patuel
Exony Ltd - London, UK

Nov 19 '05 #3
The Request and Response objects are not available in the
Application_OnStart. So, I'm not sure who you would "show a specific page"
TO. I'm thinking that maybe you want to use Session_OnStart instead.
However, be aware that this will run every time a new user Session starts
(every time a new user logs into your app).

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Salvador" <Sa******@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
Hi,

When my web application starts I want to create some instances, if an
exception is raisen I want to show a specific page instead of the main
page.
How can I transfer the execution to a new page?

using Server.Transfer doesn't work cause I don't have a page yet.

Thanks in advance

--
Salvador Alvarez Patuel
Exony Ltd - London, UK

Nov 19 '05 #4

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

Similar topics

8
by: Andreas Klemt | last post by:
Hello, I get this error Message "cannot redirect after http headers have been sent" when I do this response.redirect ("home.aspx") How can I find out with vb.net if already a http header has...
1
by: Ravindra | last post by:
Hi, Im trying to use Response.Redirect in Session_End event in Global.asax page, which is not working. Why this is not working? And if this not works here, how do I hanlde this? Any possible and...
4
by: csn | last post by:
Is it possible to have a Response.Redirect in Global.asax in the Application_Start and Session_Start events? We have code in both events, with try-catch blocks, and if an exception is caught, we...
8
by: Stimp | last post by:
I need to take my website offline for an hour or so while I perform some maintenance... is it possible to create a 'catch-all' redirect to a temporary page (i.e. something in Web.config or...
5
by: Piz | last post by:
I've read a previous discussion about the same topic, but there's a difference. I call HttpContext.Current.Response.Redirect("file.txt") from a ownmade sub in the global.asax. That doesn't works,...
1
by: wardy1975 | last post by:
Hi all, got a bit of a strange one....I am developing in ASP.NET 2.0 and I have some code in my Session_Start method that sets user attributes. If an error occurs at this time, such as the user is...
8
by: Rob T | last post by:
When I was using VS2003, I was able to compile my asp.net project locally on my machine and copy it to the production server and it would run just fine. I've now converted to VS2005. The project...
0
by: dhanashivam | last post by:
Hi all, In my application i used a session variables which is declared in the session_start of the global.asax. This session varaible is assigned by a new value and login page. this session value...
0
by: daonho | last post by:
Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs) Dim strPath As String = HttpContext.Current.Request.Path() Dim cookie As...
5
by: rote | last post by:
I'm using ASP.NET 2.0 and i have copied and pasted the code below to my Global.asax file but it desn't trap the error I want to trap the 401 access denied void Application_Error(object sender,...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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,...
0
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
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
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
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,...
0
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
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.