Search Options
close
Search the following clips:
All Clips
Everyone's Clips
My Guides
Sign Up
Install
Learn More
Login
Response.Redirect into a new window (with Extension Methods)
travislaborde
follow
0
1-3-2008 7:23 AM
2232 views
tags:
programming
,
asp.net
,
2008
Add a Comment
Login
to Comment. Not a member yet?
Sign up
Today's Top Clips
Before the Fall of the Reindeer People
It Was High Times
Chinese Farmers Sell Blood To Make Ends Meet
December 27, 2004: The Day Earth Survived the Greatest Stellar Attack -Ever
26 Amazingly Funny Dog Yoga Pictures
The 50 Funniest Headlines Of 2009 [pics]
UN-Backed Troops Accused of Killing & Raping Civilians
Walls and Barriers Around the World
Human foods that are toxic to cats
Agnes Cross: Would Tiger Woods Please Go Away?
visit the
Top Clips page
View the Top Clips from
January 3, 2008
Embed This Clip In Your Site...
<div style="margin: 12px 0px; font-family: arial; color: #333333; background: #ffffff; border: solid 4px #e5e5e5; width: 100%; clear: left;"><div class="CM_CTB_Content_Wrap" style="margin: 0px; padding: 0px;background-color: #ffffff;"><div style="border-bottom: solid 1px #dcdcdc; white-space: nowrap; margin-bottom: 8px; background-color: #eeeeee ;background-image: url(http://www.clipmarks.com/images/source-bg.gif); background-repeat: repeat-x; height: 24px; line-height: 24px; vertical-align: middle; padding-bottom: 4px; color: #666666; font-size: 10px;" ><a href="http://clipmarks.com/clip-to-blog/" title="see clips that are hot right now"><img src="http://content.clipmarks.com/blog_embed/42a2f904-765f-458a-a544-0bb4868c4583/99451016-5171-4AB9-A11A-0AE556C53BAF/" alt="" width="19" height="19" border="0" style="vertical-align: middle; margin: 0px 4px; display: inline; border: none; float:none;" /></a>clipped from <a title="http://weblogs.asp.net/infinitiesloop/archive/2007/09/25/response-redirect-into-a-new-window-with-extension-methods.aspx" href="http://weblogs.asp.net/infinitiesloop/archive/2007/09/25/response-redirect-into-a-new-window-with-extension-methods.aspx" style="font-size: 11px;">weblogs.asp.net</a></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://weblogs.asp.net/infinitiesloop/archive/2007/09/25/response-redirect-into-a-new-window-with-extension-methods.aspx"><H2> Response.Redirect into a new window (with Extension Methods) </H2></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://weblogs.asp.net/infinitiesloop/archive/2007/09/25/response-redirect-into-a-new-window-with-extension-methods.aspx"><P>This question comes up from <A mce_href="http://forums.asp.net/t/1161626.aspx" target="_blank" href="http://forums.asp.net/t/1161626.aspx">time</A> to <A mce_href="http://www.dotnet247.com/247reference/msgs/31/158269.aspx" target="_blank" href="http://www.dotnet247.com/247reference/msgs/31/158269.aspx">time</A>, to <A mce_href="http://p2p.wrox.com/topic.asp?TOPIC_ID=11046" target="_blank" href="http://p2p.wrox.com/topic.asp?TOPIC_ID=11046">time</A>. If you understand how redirects work, then you also know it is "not possible" to redirect into a new window, because a redirect on the server causes a special HTTP response to be sent to the users browser, the client. The browsers native implementation interprets the special response code and sends the user off to the destination. There's no built-in mechanism or standard for specifying a new window. </P></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://weblogs.asp.net/infinitiesloop/archive/2007/09/25/response-redirect-into-a-new-window-with-extension-methods.aspx"><P>The only way to open a new window is for it to be initiated on the client side, whether it be through script or clicking on a link.</P></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://weblogs.asp.net/infinitiesloop/archive/2007/09/25/response-redirect-into-a-new-window-with-extension-methods.aspx"><P>So the solution always proposed to this problem is to instead write out some script that opens the window, rather than using Response.Redirect:</P></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://weblogs.asp.net/infinitiesloop/archive/2007/09/25/response-redirect-into-a-new-window-with-extension-methods.aspx"><DIV class="codeSample"><PRE><SPAN><</SPAN><SPAN>script</SPAN> type<SPAN>=</SPAN><SPAN>"text/javascript"</SPAN><SPAN>></SPAN></PRE><PRE> window.open(<SPAN>"foo.aspx"</SPAN>);</PRE><PRE><SPAN></</SPAN><SPAN>script</SPAN><SPAN>></SPAN></PRE></DIV></blockquote></div><div style="margin: 0px 6px 6px 4px;"><table style="font-size: 11px;border-spacing: 0px;padding: 0px;" cellpadding="0" cellspacing="0" width="100%"><tr><td style="background:transparent;border-width:0px;padding:0px;"> </td><td align="right" style="background:transparent;border-width:0px;padding:0px;width:107px" width="107"><a href="http://clipmarks.com/share/99451016-5171-4AB9-A11A-0AE556C53BAF/blog/" title="blog or email this clip"><img src="http://content7.clipmarks.com/images/c2b-foot.png" border="0" alt="blog it" width="107" height="17" style="border-width:0px;padding:0px;margin:0px;" /></a></td></tr></table></div></div>
New from the makers of Clipmarks:
Amplify.com - Don't just share the news...Amplify it!
Clipmarks
Home
New Clips
Top Clips
Dashboard
Popular Topics
News
Life
Science
Technology
Entertainment
Get Started
Sign Up
Install Clipping Tool
How Clipping Works
Clip-to-Blog™
ClipSearch
Tools and Resources
FAQ
ClipWeek
Top Clippers
Top Tags
Site Map
About Clipmarks
About Us
Contact
Copyright
Privacy
EULA
OK