Solved

mvc redirect question

Posted on 2014-08-01
4
399 Views
Last Modified: 2014-08-02
Hi Experts,

Please see below code:

HTML
<input type="button" id="btnManage" value="ManageActivation" onclick="Test()" />


  function Test() {
        debugger;
        location.href = "/Home/GetTest";
    }

Open in new window


MVC:
 public ActionResult GetTest()
        {
  string url = "window.open('http://www.google.com','_blank');";
  return new RedirectResult(url, false);
}

Open in new window



but it goes to http://localhost:33419/Home/window.open('http://www.google.com','_blank');
and it says HTTP Error 404.0 - Not Found

I want to open google.com in new tab.

return Redirect(url); is also not working.

thanks
meetDinesh
0
Comment
Question by:Dinesh Kumar
  • 2
4 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 40234149
Is there any reason why you're not simply doing:
<input type="button" id="btnManage" value="ManageActivation" onclick="Test()" />
  function Test() {
        debugger;
        window.open('http://www.google.com','_blank');
    }

Open in new window

?
0
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 500 total points
ID: 40234339
I think the URL is supposed to be variable.

Have you tried:

'javascript:window.open('http://www.google.com','_blank')'

?
0
 

Author Closing Comment

by:Dinesh Kumar
ID: 40236186
Thank you.

  public ActionResult MA(MA inputs)
        {

               return Content(script); //script contains window.open('..  like string.
       }  

 var callBackFunction = function (result) {
        var tmpFunc = new Function(result);         //also avoided eval
        tmpFunc();        
    }
0
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 40236299
Thanks for sharing!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now