?
Solved

ASP.net VB.net Stopping Pop Up Blocker

Posted on 2014-02-24
2
Medium Priority
?
640 Views
Last Modified: 2014-02-24
Hi

I am calling the following code as per the article at this link
    'http://www.codeproject.com/Tips/317410/Response-Redirect-into-a-new-window
using
ResponseHelper.Redirect("Altron_PopUp.aspx", "_blank", "menubar=0,width=100,height=100")

but I get a message saying Pop Up Blocker and have to hold the Ctrl button down
How do avoid the user having to hold the Ctrl button down?

Public Class ResponseHelper

    Private Sub New()
    End Sub

    Public Shared Sub Redirect(url As String, target As String, windowFeatures As String)
        Dim context As HttpContext = HttpContext.Current

        If ([String].IsNullOrEmpty(target) OrElse target.Equals("_self", StringComparison.OrdinalIgnoreCase)) AndAlso [String].IsNullOrEmpty(windowFeatures) Then

            context.Response.Redirect(url)
        Else
            Dim page As Page = DirectCast(context.Handler, Page)
            If page Is Nothing Then
                Throw New InvalidOperationException("Cannot redirect to new window outside Page context.")
            End If
            url = page.ResolveClientUrl(url)

            Dim script As String
            If Not [String].IsNullOrEmpty(windowFeatures) Then
                script = "window.open(""{0}"", ""{1}"", ""{2}"");"
            Else
                script = "window.open(""{0}"", ""{1}"");"
            End If

            script = [String].Format(script, url, target, windowFeatures)
            ScriptManager.RegisterStartupScript(page, GetType(Page), "Redirect", script, True)
        End If
    End Sub

End Class
0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 39883953
That is client setting and you would not be able to change it (for good reason).
0
 

Author Closing Comment

by:Murray Brown
ID: 39884701
Got you! Makes sense. No one wants to be plagued by pop-ups. Went for an approach with panels, i.e. showing/hiding them instead of a pop-up

Thanks
Murray
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 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