Solved

mvc redirect question

Posted on 2014-08-01
4
405 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

816 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

8 Experts available now in Live!

Get 1:1 Help Now