[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ASP.net VB.net Stopping Pop Up Blocker

Posted on 2014-02-24
2
Medium Priority
?
650 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
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

Technology Partners: 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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month20 days, 3 hours left to enroll

873 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