Solved

response.redirect

Posted on 2004-08-17
13
224 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
[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
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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: 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
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 …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

630 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