asp.net Javascript window.location Url.Action不工作

asp.net Javascript window.location Url.Action不工作,javascript,c#,asp.net,vb.net,Javascript,C#,Asp.net,Vb.net,我试图让JavaScript在ASP.NET中工作 我的JavaScript: function reportOrder(sender, args) { alert("Message"); window.location.href = @Url.Action("StartReport", "PrintOut", New With {.Area = "Printing", Key .ReportName = "Test",

我试图让JavaScript在ASP.NET中工作 我的JavaScript:

 function reportOrder(sender, args) {
    alert("Message");

    window.location.href = @Url.Action("StartReport", "PrintOut", New With {.Area = "Printing", Key .ReportName = "Test",
                                                    Key .typeOfReport = TypeOfPrintingIS.Order,
                                                    Key .CompanyId = DirectCast(ViewData("CompanyId"), Guid),
                                                    Key .ExchangePrintData = CType(locOrderReport, ExchangeData.IExchangePrintData)});

}
首先,该功能起作用,当我禁用window.location时,会发出警报!因此,问题必须在@UrlAction中(

而且,这个区域也在工作,因为当我使用一个类似的Html.RenderAction函数和另一个函数的其他指令时,它工作得很好

控制器内的功能:

 <HttpPost>
    Function StartReport(ReportName As String, typeOfReport As TypeOfPrintingIS, CompanyId As Guid, ExchangePrintData As Code.ExchangeData.IExchangePrintData) As ActionResult
        Dim model As New HTML5ViewerModel()
        model.ViewerOptions.UseUIMiniStyle = True
        locReportHelper.CompanyId = CompanyId
        locReportHelper.ReportName = ReportName
        locReportHelper.TypeOfReport = typeOfReport
        locReportHelper.ExchangePrintData = ExchangePrintData
        model.ReportName = locReportHelper.CreateReportId

        Return View("Html5Viewer", model)
    End Function

函数StartReport(ReportName作为字符串,typeOfReport作为TypeOfPrintingIS,CompanyId作为Guid,ExchangePrintData作为代码。ExchangeData.IExchangePrintData)作为ActionResult
作为新HTML5ViewerModel()的Dim模型
model.ViewerOptions.UseUIMiniStyle=True
locReportHelper.CompanyId=CompanyId
locReportHelper.ReportName=ReportName
locReportHelper.TypeOfReport=TypeOfReport
locReportHelper.ExchangePrintData=ExchangePrintData
model.ReportName=locReportHelper.CreateReportId
返回视图(“Html5Viewer”,模型)
端函数
“IExchangePrintData”接口是一个空接口,用于验证正确的类

你们有谁有主意吗?
THX很多-周末愉快

尝试用单引号将razor指令括起来。它看起来像这样:
window.location.href='@Url.Action(“SomeActionName”、“SomeControllerName”等);


我想这应该行得通,因为你提到了
@Html.RenderAction
工作得很好。

使用
@Url.Action
时浏览器控制台中有任何错误吗?THX很多!-这是一把神奇的钥匙!