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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • Last Modified:

response.redirect

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
testn1
Asked:
testn1
5 Solutions
 
raterusCommented:
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
 
nauman_ahmedCommented:
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
 
testn1Author Commented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
AerosSagaCommented:
which event is redirecting on the second page?
0
 
testn1Author Commented:
page load()
0
 
testn1Author Commented:
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
 
AerosSagaCommented:
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
 
AerosSagaCommented:
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
 
DotNetLover_BaanCommented:
Hi there...
check the Page_Load event of "welcome.aspx".... might be some trouble there...
-Baan
0
 
testn1Author Commented:
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
 
AerosSagaCommented:
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
 
KittrickCommented:
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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now