Kontext.Antwort.Umleiten von ein handler funktioniert nicht

Ich versuche, Folgendes zu tun :
- Call-thru-JQuery-eine Funktion, eine Prozedur,
- sobald die Behandlung erfolgt ist, die Umleitung zu einer Seite.

Das Problem ist, dass die Seite scheint nicht zu laden.

Machte ich den folgenden code, um klarsten.

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication3._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script type="text/javascript" src="js/jquery-ui.js"></script>
<script type="text/javascript" src="js/jquery.js""></script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
  <script type="text/javascript" language="javascript">
function CallHandler() {
      console.info("Entering CallHandler");
      $.ajax({
          type: 'POST',
          url: "Handlers/MyFunction.ashx",
          data: { helloworld: 'hello world'},
          success: function (data) {
              console.info(data);
              }
          });
      }

    </script>
<asp:HyperLink runat="server" ID="linkForTest" onclick='CallHandler();' Text='Click Me'     />            
</asp:Content>

und mein handler ist wie folgt :

///<summary>
///Summary description for MyFunction
///</summary>
public class MyFunction : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        context.Response.Write(context.Request["HelloWorld"]);
        context.Response.Redirect("~/Login/WebForm1.aspx");
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }
}

Sollte es rief meine Seite "Login/Webform1.aspx", aber es fordert nichts.
Aber Firebug dont zu finden, scheint ein Problem... nur es hält zu versuchen, um eine Seite zu laden... Und scheiterte.

Irgendwelche Ideen ?

InformationsquelleAutor PetersLast | 2012-04-18

Schreibe einen Kommentar