Response Redirect - Open Link in New Window

Posted by bacis09 on Stack Overflow See other posts from Stack Overflow or by bacis09
Published on 2010-04-14T10:28:01Z Indexed on 2010/04/14 10:43 UTC
Read the original article Hit count: 179

Filed under:
|

First, I've taken the time to review this question which seems to be the most similar, however, the solution that seems to have been selected will not work in my scenario.Not to mention I worry about some of the comments claiming it to be brittle or an inadequate solution.

http://stackoverflow.com/questions/104601/asp-net-response-redirect-to-new-window

-We have an XML document which basically contains all of the information for a Side menu.

-We have numerous URLS which are stored in a constants class.

-One of the elements in a string of XML (well call it label) is used to determine if the menu item is created as a LinkButton or a Label.

-Links use a custom user control that is used standard for all links across the application (why suggestion on similar thread doesn't work - I don't want all links to open in a new window - just one)

-One of the elements in a string of XML (well call it function) is used in a Switch statement to generate our links using Response Redirect.

It may look something like this.

    switch (function)
    {
      case goto 1:
        string url;
        if (user_group == 1)
        {
            url = Constants.CONSTANT1
        }
        else
        {
            url = Constants.CONSTANT2
        }
        Response.Redirect(url)
      case goto 2:
        ......
      default:
        ......
        break;
}

Given this scenario, I'm trying to find the best way to quickly open a New Window, when a specific case in this switch statement is met. Can it be done with Response Redirect (this seems to be arguable - people say no it can't, yet other people say they have made it work)? If not, what alternative can work here?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#