I encountered this problem when I was developing with MVC (Surfacecontroller) under the Umbraco platform.
Memberedit is a partial View
[Httpget][actionname ("Memberedit")] PublicActionResult Membereditget () {if(Members.getcurrentloginstatus (). isLoggedIn) {varCurrentprofilemodel =NewGallagher.Fuelsystems.Core.Models.ProfileModel () {//Some codes here }; returnPartialview ("Memberedit", Currentprofilemodel); } Else { returnPartialview ("Memberlogin"); //return Redirect ("/login"); } }
At first, in the Else statement, I was using return Redirect ("/login"); I reported this error, and then I changed it to return Partialview ("Memberlogin"); There's no problem.
On the Internet to search for this error message, the explanation is probably as follows:
--------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------
The limitation exists because MVC has already started rendering a view to the client. The effect of redirecting is undefined. It could work perfectly, it could continue rendering the original view without redirecting, it could throw a different exc Eption, etc.
Since The result of performing this action is undefined, the framework blocks it. In practice, renderaction should never is used to render anything other than a view (or view-like content) for similar Rea Sons.
In your particular case, the outer action should redirect. If you ' re just going to end up redirecting from within the view anyway without showing anything to the user and then there WA s really no purpose to going through the view of the first place, as the outer action could has delegated the work Approp Riately on its own.
The redirect info is stored in response header. However, the response was already being sent when a child action was run so headers can ' t be written.
--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------
[ASP. NET MVC] Child actions is not allowed to perform redirect