Open Closed

Correct way to return string message from MVC controller to angular #7024


-1
flavio created

Hi all, I need to know if the framework has a correct way to retrieve messages from MVC controller back to angular(a method or something useful)... We're using MVC methods to proccess heavy data, and needs to return a message OK or not. Because we're using some third-party DLL's in .NET framework, we cant use services in this case. Thanks in advance,


6 Answer(s)
  • 0
    aaron created
    Support Team

    What do you mean? Just return it.

  • 0
    flavio created

    I wanna know if the framework has any useful method to store accessible data from MVC controller, reaching Angular7 , like TempData[] in MVC. Another way could be store cookies from MVC controller , and the same cookie accessible in angular7 classes. I really need to communicate between MVC and angular without use of services...

    Thanks in advance...

  • 1
    aaron created
    Support Team

    Seems like an XY problem. Can you describe a use case?

  • 0
    flavio created

    No, the real problem here is: you and this team try to close maximum of tickets opened without any care about customers, and even more, send offensive and useless articles like this... I dont wanna know about this stupid article, I need a responsible technical staff to solve a problem related to your product. Our company bought this license, and your team must provide a better communication ... simple like this...

  • 1
    ismcagdas created
    Support Team

    Hi @flavio

    ASP.NET Core MVC already provides this functionality. You can just return string like below:

    public string TestX()
    {
    	return "OK";
    }
    

    If your controller is derived from {YourProjectName}ControllerBase, then you need to add DontWrapResult attribute to your action like below:

    [DontWrapResult]
    public string TestX()
    {
    	return "OK";
    }
    

    By the way, we always try to help our customers but as @aaron mentioned, there is nothing related to AspNet Zero in this issue.

    Thanks,

  • 1
    ukocabicak created

    Geez..

    And I thought I am dealing with these kind of stuff all the day.