Error when setting UseSSL= true

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
i am developing plugin and it works fine, but when i set SSL = true i am getting this error:
"Child actions are not allowed to perform redirect actions."

its fails on @Html.Action("Plugin", "MyPlugin")
i understand that it fails while trying to redirect to the "https://"

its strange becouse there are some else  @Html.Action on this view.

i have added [NopHttpsRequirement(SslRequirement.No)] to the action method but it doesn`t work.
what else can i do? any help would be great.
11 years ago
olga_zov wrote:
"Child actions are not allowed to perform redirect actions."

That's true. You cannot make redirects in child actions. But you can try the following "hack":
1. Inject IWebHelper in your plugin
2. Open a plugin action method
3. Add the following code to it:
if (!_webHelper.IsCurrentConnectionSecured())
{
   //redirect to HTTPS
   var thisPageUrl = _webHelper.GetThisPageUrl(true, true);
   this.Response.Redirect(thisPageUrl);
}
11 years ago
thanks, i`ll try this
11 years ago
it seems like i pretty stuck with this stuff....

i get the error befor it even reach the controller method, so adding
" if (!_webHelper.IsCurrentConnectionSecured()) ..."
did not helped.

i`m trying to make some banner plugin so it should not make any redirection.

i can`t get why other action methods working fine on the same page, (for example,  @Html.Action("HomepagePromotedProducts", "Catalog") works fine) but mine is fails.
11 years ago
olga_zov wrote:
i get the error befor it even reach the controller method, so adding

What error are you getting? The same one?
I forgot to mention that you have to remove "[NopHttpsRequirement(SslRequirement.No)]" before applying my code.
11 years ago
yes, the same error, but now is appears when it http:// and not https:// (https://   works fine with you code)

and yes, i`ve removed "[NopHttpsRequirement(SslRequirement.No)]
11 years ago
What interfaces are you using? IWidgetPlugin? Could you share you solution so I can test it?
11 years ago
BasePlugin


maybe it because i really should use IWidgetPlugin and  IPlugin.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.