AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
9.0.2 redirect to home page from partial view
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
For the life of me I can't get a redirect to work from inside a simple widget I built. I just want to redirect back to the store home page with the desired affiliate id query string. Every time, the store home page renders inside the existing page instead of redirecting the entire browser. How do you do it? Code:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult NoAffiliate(NoAffiliateModel model)
{
if (ModelState.IsValid)
{
// check the affiliate ID
Affiliate affiliate = _affRepo.Load(AlwaysConvert.ToInt(model.AffiliateId));
if (affiliate != null)
{
string homeUrl = NavigationHelper.GetHomeUrl();
homeUrl += "/?afid=" + affiliate.Id;
return JavaScriptRedirect(Url.Content(homeUrl));
}
model.IsFailure = true;
model.IsMessagePanelVisible = true;
return PartialView("_NoAffiliate", model);
}
return PartialView("_NoAffiliate", model);
}
|
|
|
|
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
Finally think I found the solution. I so hate MVC, Javascript and diesel pickup trucks Code:
string redirectUrl = "/";
return JavaScript(string.Format("window.location = '{0}'", redirectUrl));
|
|
|
|
AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
9.0.2 redirect to home page from partial view
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close