?
Solved

Response.Redirect not working in Global.asax

Posted on 2013-06-29
3
Medium Priority
?
3,222 Views
Last Modified: 2013-07-27
Hi,

i am working on ASP.net 2.0 using c#

Response.Redirect() to new url on different domain is not working from global.ascx.

HttpContext.Current.Response.Redirect("http://www.mynewdomain/myfile.aspx", true) is not working from global.ascx.

But it works from any user control.

Please advise.

Regards,
0
Comment
Question by:tia_kamakshi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Assisted Solution

by:Easwaran Paramasivam
Easwaran Paramasivam earned 1000 total points
ID: 39287836
0
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39287838
Hi,
maybe a typo but do you mean global.asax?
In which event did you add your redirect code?
If you want to redirect any request to this web app to another url, then either use a web.config redirect or configure IIS to redirect.
HTH
Rainer
0
 
LVL 11

Accepted Solution

by:
SAMIR BHOGAYTA earned 1000 total points
ID: 39320445
Hi....

Replace Response.Redirect("~/Error.aspx"); with:

// You've handled the error, so clear it. Leaving the server in an error state can cause unintended side effects as the server continues its attempts to handle the error.
Server.ClearError();

// Possible that a partially rendered page has already been written to response buffer before encountering error, so clear it.
Response.Clear();

// Finally redirect, transfer, or render a error view
Response.Redirect("~/Error.aspx");
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question