Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 16th, 2004, 03:42 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: Johannesburg, , South Africa.
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default Response.redirect in new window

Hi

I have got a page that redirects users depending on their NT group memebership e.g

Case "Group A"
Response.redirect("Y.asp")

I need to redirect some of them to a page and that needs to open in a new window... This does not seem possible with VBS? Maybe add a JS function? Any sugestions welcome

Regards
Marnus

Such is Life!
Reply With Quote
  #2 (permalink)  
Old March 16th, 2004, 12:34 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Response.Redirect is only going to work within the existing window. Instead, you need to write out some javascript to open the new window when the page is redrawn. Instead of redirecting, you just write out the JS.

window.open(...)

But watch out for popup blockers.

Peter
------------------------------------------------------
Work smarter, not harder.
Reply With Quote
  #3 (permalink)  
Old July 12th, 2004, 05:07 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: Johannesburg, , South Africa.
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default

Hi

I have been using this method for a while now but it seems like popup stoppers is starting to cause problems. Is there any other way to open a new IE window without the popup stoppers blocking it?

Regards
Marnus
Reply With Quote
  #4 (permalink)  
Old July 12th, 2004, 05:23 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

There is a target attribute for HREF. You can set its value as _blank to open the link in a new window. For e.g. this link will open in a new window.
<a href="http://www.microsoft.com" target="_blank">Microsoft web site</a>

If you want to submit a form to a new page, the same attribute can be used in form tag.

BTW, could you please give some more details about the particular programming situation ? Then somebody may be able to give you better solution.
Reply With Quote
  #5 (permalink)  
Old July 12th, 2004, 05:31 AM
Friend of Wrox
Points: 1,288, Level: 14
Points: 1,288, Level: 14 Points: 1,288, Level: 14 Points: 1,288, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2004
Location: Stockholm, Sweden
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

function ak_forecolor()
    {
        var mycolor = showModalDialog(subdirectory + "insertcolors.html", "", ");

    }

this function wil be open a windows of that file


Numan
--------------------------------------------------
Love is the most beautiful thing of this world. So do this !
Reply With Quote
  #6 (permalink)  
Old July 12th, 2004, 10:18 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Marnus,

I too can't think of anything other than Javascript - window.open(...) method to achieve this. May be you can explain more an what you are trying to do, so that one would come up with alternative solutions if any.

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #7 (permalink)  
Old July 13th, 2004, 01:55 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: Johannesburg, , South Africa.
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default

Hi

Thanks for the replies. I have got a customer login page that authenticates on AD Accounts. So if the user logs in I check the group membership. Then I have got a "Select Case" to redirect them to a certian page/build a page depending oj the group. The one page is a Java App that doesnt look nice if it runs on the same page with the frames so I need to open this in a new window.

Regards
Marnus
Reply With Quote
  #8 (permalink)  
Old July 18th, 2004, 07:30 PM
Authorized User
 
Join Date: Jul 2004
Location: Barrie, Ontario, Canada.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use a function and call it in place of response.redirect. Like this...

<%
strLocation = "testlink.asp"

 openlink(strLocation) ' replaces response.redirect
function openlink(link)
%>
<SCRIPT language='javascript'>window.open(' <%=strLocation%> ');</SCRIPT>
<%
end function
%>

Of course you can use all the parameters in the javascript for setting the new window, this is just a simple example of doing it in ASP. You could also use response.write inside of the code block instead of switching to HTML to create the function. your choice.
Reply With Quote
  #9 (permalink)  
Old November 29th, 2004, 04:19 PM
Registered User
 
Join Date: Nov 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Only thing you need to put the link in the js of the function because the function doesnt know what strLocation is.
So like this.

function openlink(link)
        %>
        <SCRIPT language='javascript'>window.open(' <%=link%> ');</SCRIPT>
        <%
    end function

Reply With Quote
  #10 (permalink)  
Old August 29th, 2010, 07:03 PM
Registered User
 
Join Date: Aug 2010
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by acdsky View Post
Hi

I have got a page that redirects users depending on their NT group memebership e.g

Case "Group A"
Response.redirect("Y.asp")

I need to redirect some of them to a page and that needs to open in a new window... This does not seem possible with VBS? Maybe add a JS function? Any sugestions welcome

Regards
Marnus

Such is Life!


TRY THIS:


In HTML code:

<script type="text/javascript">
function NewWindow() {
document.forms[0].target = "_blank";
}
</script>

<asp:Button runat="server" ID="btnprint" Text="Open in new window" OnClick="btnprint_Click" OnClientClick="NewWindow();" />


And in the Event Click of the button in vb.code:


Protected Sub btnprint_Click(ByVal sender As Object, ByVal e As System.EventArgs)

Response.Redirect("pagina.aspx")

End Sub



=)
Reply With Quote
The Following User Says Thank You to aperezgzlz For This Useful Post:
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
response.redirect ava_h .NET Framework 2.0 0 October 18th, 2006 10:21 PM
response.redirect crmpicco Classic ASP Basics 3 February 9th, 2005 01:50 AM
response.redirect in new window mahulda General .NET 2 September 7th, 2004 10:45 PM
Response.Redirect dhborchardt Classic ASP Basics 4 June 16th, 2003 05:56 AM



All times are GMT -4. The time now is 05:33 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.