我创建了名为ApiController的普通asp mvc控制器来返回Sub sending_bday_greetings_method2(ByVal nm As String, ByVal emid As String)
Dim olApp As Outlook.Application
Dim olMail As MailItem
Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
s = "<p> <p align='left'><font size='3' face='arial' color='blue'><i> Dear " & nm & ", </p>" & vbNewLine
s = s & "<p> <p align='CENTER'><font size='3' face='arial' color='red'><i> We Wish you a very Happy Birthday! </p>" & vbNewLine
s = s & "<left><p align='CENTER'><img src=""http://simplyizzy.files.wordpress.com/2012/05/happy_birthday1.png"">" & vbNewLine
s = s & vbNewLine & "<left><p><p align='Left'><font size='3' face='arial' color='blue'><i>Regards<br>" & "Reutech Radar Systems</p>"
With olMail
.To = emid
.Subject = "Happy B'day!"
.HTMLBody = s
.Display
'.Send
End With
Set olApp = Nothing
Set olMail = Nothing
End Sub
结果。在其中一个动作方法中,我想返回json,然后重定向到另一个动作方法。
将json返回到api请求后,我必须使用json
我尝试使用SignalR
,但它没有重定向到其他操作方法。
行动方法1
Action filter
行动方法2
[NotifyUserActionFilter]
public ActionResult NotifyUser(int ID)
{
return Json("true",JsonRequestBehavior.AllowGet);
}
操作过滤器
//the returning view has signalR javascript in it
public ActionResult ThankYou()
{
string Tempval = TempData["tempID"].ToString();
return View();
}
答案 0 :(得分:0)
假设您需要来自&#34; NotifyUser&#34;的结果。并且你在视图中使用它我会使用jquery AJAX调用来处理你的问题。
简单地说,打电话给你的&#34; NotifyUser&#34; Ajax中的方法。在&#34;成功&#34;我将测试ajax调用以查看json结果是否为&#34; true&#34;。如果它是我然后将重定向到新视图。设置&#34; window.location .....&#34;
如果您不使用json结果,那么您只需重定向&#34; NotifyUser&#34;方法