繁体   English   中英

.net 核心 web api 将主页重定向到同一解决方案中的 mvc 项目

[英].net core web api redirect home page to mvc project in same solution

I have .net core web api solution, in the same solution I have mvc project that contains my home page template, how to redirect my web api controller to the home page in mvc project?? 我看到了这个,但我不知道该怎么做。

public HttpResponseMessage Get()
{
    // ... do the job

    // now redirect
    var response = Request.CreateResponse(HttpStatusCode.Moved);
    response.Headers.Location = new Uri("http://www.abcmvc.com");
    return response;
}

I have .net core web api solution, in the same solution I have mvc project that contains my home page template, how to redirect my web api controller to the home page in mvc project?? 我看到了这个,但我不知道该怎么做。

public HttpResponseMessage Get()
{
    // ... do the job

    // now redirect
    var response = Request.CreateResponse(HttpStatusCode.Moved);
    response.Headers.Location = new Uri("http://www.abcmvc.com");
    return response;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM