+1-888-365-2779
Try Now
More in this section

Forums / Suggestions / Kick back to login page instead of throwing an exception

Kick back to login page instead of throwing an exception

15 posts, 0 answered
  1. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    09 Mar 2009
    Link to this post
    Hi,

    I noticed that after you log in to Sitefinity, if at some point (i.e. via clearing your cookies) you become no longer logged in, there is simply an unhandled exception thrown by Sitefinity.  Any reason not to just catch this, and redirect back to the login page?

    Thanks,
    John
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Mar 2009
    Link to this post
    Hi John,

    After you clear your cookie, you should not get "not implemented error" message. When you click on an link you should be redirected to the login page of sitefinity.

     <authentication mode="Forms"
          <forms name=".ASPNET" loginUrl="~/sitefinity/login.aspx" protection="All" timeout="1440" path="/" /> 
        </authentication> 

    There is private method in our implementation RedirectToLogin() that redirect users to the login page and add ReturnUrl query string to the url with the last clicked link. Another possible way is getting PageAccessDenied - 403 error.

    Could you send a stack trace of the error you are getting. This will help us to indentify what the problem is.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    09 Mar 2009
    Link to this post
    Hi,

    Thanks for the quick response.  Now that I look at it, it seems like it could be related to something with newsletters?

    System.Net.WebException: The remote server returned an error:(401) Unauthorized.
    at System.Net.HttpWebRequest.GetResponse()
    atTelerik.WebServices.DynamicProxy.WsdlHelper.GetWsdlFromUri(String uri, CookieauthCookie)
    at Telerik.WebServices.DynamicProxy.WsdlHelper.GetWsdl(Stringsource, Cookie authCoocke)
    atTelerik.WebServices.DynamicProxy.WebServiceDynamicProxy.BuildProxy()
    atTelerik.WebServices.DynamicProxy.WebServiceDynamicProxy..ctor(StringwsdlLocation, Cookie authCookie)
    atTelerik.Notifications.Services.MailingServiceProxy..ctor(String wsdlUri)
    atTelerik.Notifications.Services.MailingServiceProxy..ctor()
    atTelerik.Notifications.Newsletters.DataManager.OnInitialized()
    atTelerik.ManagerBase`1.Initialize()
    at Telerik.ManagerBase`1..ctor(StringproviderName)
    at Telerik.ManagerBase`1..ctor()
    atTelerik.Notifications.Newsletters.DataManager..ctor(String providerName)
    atTelerik.Notifications.Newsletters.DataManager..ctor()
    atTelerik.Notifications.Newsletters.DataManager.get_Providers()
    atTelerik.Notifications.Newsletters.DataManager.get_SecurityRoots()
    atTelerik.Notifications.Newsletters.NewsletterModule.get_SecurityRoots()
    atTelerik.Cms.Web.UI.Util.CheckPermissions(IModule module, Int32 perm)
    atTelerik.Cms.Web.UI.Util.CheckMinimalPermissions(IModule module)
    atTelerik.Cms.Web.UI.MainMenuSourceView.ExecuteSelect(DataSourceSelectArgumentsarguments)
    at System.Web.UI.DataSourceView.Select(DataSourceSelectArgumentsarguments, DataSourceViewSelectCallback callback)
    atSystem.Web.UI.WebControls.DataBoundControl.PerformSelect()
    atSystem.Web.UI.WebControls.BaseDataBoundControl.DataBind()
    atAdmin_Admin.Page_Load(Object sender, EventArgs e) inc:\webs\www.connectionsacademy.com\2009\Sitefinity\Admin\Admin.master.cs:line 27
    at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o,Object t, EventArgs e)
    atSystem.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgse)
    at System.Web.UI.Control.OnLoad(EventArgs e)
    atSystem.Web.UI.Control.LoadRecursive()
    atSystem.Web.UI.Control.LoadRecursive()
    atSystem.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)

    Any thoughts here?

    Thanks.

  4. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    09 Mar 2009
    Link to this post
    Note: I have the 3.6 hotfix installed.
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Mar 2009
    Link to this post
    Hi John,

    Could you Open the folder ~/Sitefinity/ServiceAssemblies and make sure you delete the assembly there. When you initialize the Newsletters module, it will be recreated. Then try to load your website. Are you able to access newsletter module? It seems that  the request to the web service couldn't be authenticated -"The remote server returned an error:(401) Unauthorized. " Also try to enable anonymous authentication for your web site.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    09 Mar 2009
    Link to this post
    Hi,

    I have cleared the ServiceAssemblies directory.  In fact, before doing that, I was getting a different exception, which this thread showed me how to fix (by deleting the assembly in that directory).  Only after doing that did I start seeing this 401 exception.  The newsletters module, however, does NOT work.  When I click it, I see this error:

    System.Net.WebException: The remote server returned an error:(401) Unauthorized. 
    at System.Net.HttpWebRequest.GetResponse() 
    atTelerik.WebServices.DynamicProxy.WsdlHelper.GetWsdlFromUri(String uri, CookieauthCookie) 
    at Telerik.WebServices.DynamicProxy.WsdlHelper.GetWsdl(Stringsource, Cookie authCoocke) 
    atTelerik.WebServices.DynamicProxy.WebServiceDynamicProxy.BuildProxy() 
    atTelerik.WebServices.DynamicProxy.WebServiceDynamicProxy..ctor(StringwsdlLocation, Cookie authCookie) 
    atTelerik.Notifications.Services.MailingServiceProxy..ctor(String wsdlUri) 
    atTelerik.Notifications.Services.MailingServiceProxy..ctor() 
    atTelerik.Notifications.Newsletters.WebControl.Admin.ControlPanel.CreateChildControls()
    at System.Web.UI.Control.EnsureChildControls() 
    atSystem.Web.UI.Control.PreRenderRecursiveInternal() 
    atSystem.Web.UI.Control.PreRenderRecursiveInternal() 
    atSystem.Web.UI.Control.PreRenderRecursiveInternal() 
    atSystem.Web.UI.Control.PreRenderRecursiveInternal() 
    atSystem.Web.UI.Control.PreRenderRecursiveInternal() 
    atSystem.Web.UI.Control.PreRenderRecursiveInternal() 
    atSystem.Web.UI.Control.PreRenderRecursiveInternal() 
    atSystem.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)

    Also a 401 error, but slightly different stack trace.  The first error seems to be on the master page (so it affects everything); this one seems to be newsletter-specific.

    Anonymous access is enabled.

    Thanks,

    John

  7. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    13 Mar 2009
    Link to this post
    Hello John,

    Could you please check if the new assembly is being generated?

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    13 Mar 2009
    Link to this post
    Hi,

    No, it has not been generated.  When is this supposed to occur?

    Thanks,
    John
  9. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    17 Mar 2009
    Link to this post
    Hello John,

    This is supposed to be observed when:
    • Anonymous authentication is disabled
    • Medium trust is enabled.
    Could you please double check that these are not the case? If you tell us the exact version which you are using, we could send you the assembly needed.
    Best wishes,
    Georgi
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  10. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    01 Apr 2009
    Link to this post
    Hi,

    To return to the original topic of this thread (kicking a user back to the login page when they are not logged in), this seems to be working fine now in the case of pages within Sitefinity admin (i.e. /sitefinity/admin/pages.aspx), but I am still noticing one issue in particular.  If I want to show a preview of a page to a user:


    If the user goes there and they are not logged in to Sitefinity, they just get an exception:

    System.Security.SecurityException: Permission denied. 
    at Telerik.Security.Permissions.ApplicationPermission.ThrowSecurityException() 
    at Telerik.Security.Permissions.ApplicationPermission.Demand() 
    at Telerik.Cms.Web.PreviewPage.OnPreInit(EventArgs e) 
    at System.Web.UI.Page.PerformPreInit() 
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
    at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
    at System.Web.UI.Page.ProcessRequest() 
    at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) 
    at System.Web.UI.Page.ProcessRequest(HttpContext context) 
    at ASP.sitefinity_admin_previewpage_aspx.ProcessRequest(HttpContext context) 
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 
    The action that failed was: 
    Demand 
    The type of the first permission that failed was: 
    Telerik.Cms.Security.PagePermission 
    The first permission that failed was: 

    version="1" 
    state="None" 
    grant="1" 
    deny="0"/> 

    The demand was for: 

    version="1" 
    state="None" 
    grant="1" 
    deny="0"/> 

    The assembly or AppDomain that failed was: 
    Telerik.Security, Version=3.6.1870.2, Culture=neutral, PublicKeyToken=dfeaee0e3978ac79



    Is this the expected functionality?  If so, is there a known way to have the user be redirected to the login page in this situation?

    Thanks,
    John
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    02 Apr 2009
    Link to this post
    Hello John,

    If the user is not authenticated and it tries to see a page in preview mode the error you are getting is thrown instead if redirecting to the login page. This is a bug related to Sitefinity 3.6 hotfix( I noticed that you are using this version.) The problem will be sorted out for the upcoming SP( middle of April)

    Let us know if there is anything else that we can do for you.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  12. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    02 Apr 2009
    Link to this post
    Hi,

    Thank you.  Can you please post to this thread when the SP is released?

    Thanks,
    John
  13. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    03 Apr 2009
    Link to this post
    Hi John,

    We will make a post at Announcements section of our Forum for all community members.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  14. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    17 Aug 2009
    Link to this post
    Is there a patch or workaround for this problem?


  15. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    17 Aug 2009
    Link to this post
    Hi Connections Academy,

    The problem has been sorted about 4 months ago. "The problem will be sorted out for the upcoming SP( middle of April)"

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
15 posts, 0 answered