Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Response.Redirect not working in Global.asax

Posted on 2013-06-29
3
Medium Priority
?
3,319 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
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

963 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