Solved

response.redirect

Posted on 2004-08-17
13
216 Views
Last Modified: 2010-04-07
why when i response.redirect to one page it would hang/sit on the same browser page....  and why it would work if i redirect to other pages?
0
Comment
Question by:testn1
13 Comments
 
LVL 33

Accepted Solution

by:
raterus earned 100 total points
ID: 11821098
Clearly the one page you are redirecting to has a problem, can you debug and figure out what is hanging?  What happens when you try to access it directly from the address bar?
0
 
LVL 25

Assisted Solution

by:nauman_ahmed
nauman_ahmed earned 100 total points
ID: 11821107
Are you redirecting to the same page? Remember to have some validation before you redirect to a same page example:

if (Page.IsPostBack)
{
   //handle the event
   Response.Redirect("MyPage.aspx?Action=Updated");
}

Otherwise if I just place the Response.Redirect("MyPage.aspx") without any validation, my page will keep on redirecting to itself. Or its the other way arnd :) Please explain your question

Best, nauman
0
 

Author Comment

by:testn1
ID: 11821199
i'm on debug mode.. i do get to the page fine before the redirecting .. (fyi - it's importing another assembly/classes) and the page loads fine.

==

no, i'm not redirecting to my same page ...

right now .. i'm testing:

page1.aspx  -- response.redirect("test1.aspx")

on test1.aspx code behind i have -- response.redirect("welcome.aspx") --- just sits  there, does not even time out!

same happens if I redirect directly from page1.aspx .. it just hangs.. still showing page1.aspx on the browser.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 17

Assisted Solution

by:AerosSaga
AerosSaga earned 100 total points
ID: 11821309
which event is redirecting on the second page?
0
 

Author Comment

by:testn1
ID: 11821367
page load()
0
 

Author Comment

by:testn1
ID: 11821388
but.. it doesn't work on any page... is there any way to trace what page called another?   (after you're in the page)
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11821444
public void Application_OnPostRequestHandlerExecute(Object sender, EventArgs e)
{
  ReferralLogger rlLogger;
  if (String.Empty != Request.QueryString.ToString())
    // We have query parameters so we need to log those as well
    // as the current page name
    rlLogger = new ReferralLogger(Request.Path.ToString()+"?"
                                  Request.QueryString.ToString(),
                                  Request.UrlReferrer);
  else
    // No query string, so simply log the request and the referring URL
    rlLogger = new ReferralLogger(Request.Path.ToString(),
                                  Request.UrlReferrer);
}
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11821502
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11821632
or in vb:

If Not Request.UrlReferrer Is Nothing Then
   Response.Write("<TR><TD>Referer</td><td>" & Request.UrlReferrer.ToString() & "</td></tr><pre>")
Else
   Response.Write("<TR><TD>Referer</td><td>blind (no referer)</td></tr><pre>")
End If
0
 
LVL 18

Assisted Solution

by:DotNetLover_Baan
DotNetLover_Baan earned 100 total points
ID: 11821810
Hi there...
check the Page_Load event of "welcome.aspx".... might be some trouble there...
-Baan
0
 

Author Comment

by:testn1
ID: 11823940
still nothing... what i've discovered is.. that everytime i do a HttpContext.Current.Request.Cookies.Item("test1").Item("ID")  i loose all the other items/values of my cookie, is this the normal .net behavior?
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11824133
are you making it persistant?

Protected Sub Submit_Click(sender As Object, e As EventArgs)
    Dim cookie As New HttpCookie("preferences2")
    cookie.Values.Add("ForeColor",ForeColor.Value)
    ...
    cookie.Expires = DateTime.MaxValue ' Never Expires

    Response.AppendCookie(cookie)

    Response.Redirect(State("Referer").ToString())
End Sub

Regards,

Aeros
0
 
LVL 4

Assisted Solution

by:Kittrick
Kittrick earned 100 total points
ID: 11824295
Response.Redirect only works if I remember right going to other pages as a redirection/forward. I think you might want to try Server.transfer method

Kittrick
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

777 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