Solved

response.redirect

Posted on 2004-08-17
13
212 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert to Hour/minute textbox and compare 3 53
Re-position the objects 7 98
Asp.net mvc 5 5 43
Entity Framework 7 32
AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now