Solved

response.redirect

Posted on 2004-08-17
13
211 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
which event is redirecting on the second page?
0
 

Author Comment

by:testn1
Comment Utility
page load()
0
 

Author Comment

by:testn1
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
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
Comment Utility
0
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
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
Comment Utility
Hi there...
check the Page_Load event of "welcome.aspx".... might be some trouble there...
-Baan
0
 

Author Comment

by:testn1
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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,…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

17 Experts available now in Live!

Get 1:1 Help Now