One of the reasons for this failure is SPHostUrl parameter has not been passed to the post action. It can be passed by several ways
- Use Html.BeginForm like so:
ViewBag.SPURL = Request.QueryString["SPHostUrl"];
And if the view
@using (Html.BeginForm("Upload", "Home", new { SPHostUrl = @ViewBag.SPURL }, FormMethod.Post, new { enctype = "multipart/form-data" }))
2. In C# pass the parameter in redirect statement
return RedirectToAction("Index", new {SPHostUrl = SharePointContext.GetSPHostUrl(HttpContext.Request).AbsoluteUri});
References:
No comments:
Post a Comment