Response.redirect is not redirecting in c#

I want to redirect to certain website using c#. I have written the code like:


 <button id="Buy" class="k-button">Button</button>


    $("#Buy").live('click', function () {
        url: "/Home/Redirect",
        data: JSON.stringify

        cache: false,
        dataType: "json",                       
        success: function (str) {
        type: 'POST',
        contentType: 'application/json; charset=utf-8'


   public ActionResult Redirect()
        return Json("suc",JsonRequestBehavior.AllowGet);


You cannot do a redirect on an ajax post, that will give you a 302 error. What you should be doing is to return the url from you controller method

public ActionResult Redirect()
    return Json(the_url);

and then redirect from your client-code:

    // your config goes here
    success: function(result) {

Need Your Help

Create CSV from specific columns in another CSV using shell scripting

bash shell csv

I have a CSV file with several thousand lines, and I need to take some of the columns in that file to create another CSV file to use for import to a database.