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

After login

13 posts, 0 answered
  1. omer
    omer avatar
    9 posts
    Registered:
    19 Jul 2012
    15 Jan 2010
    Link to this post
    Hi to all
    I am developing a project in sitefinity and using 2 languages
    1 English
    2 Turkish
    everything is oke but when i login in Turkish it redirects me to Turkish home page
    also when i login in English it redirects me to Turkish home page
    how can i arrange this
     
    You try at http://www.socialarch.net

    thanks for your helps
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    15 Jan 2010
    Link to this post
    Hello omer,

    We are not able to login because we do not have credentials to your website. You could check what is set for DestinationPageUrl of your Login control. You can also check whether the wrong culture is appended to the QueryString as ReturnUrl.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. omer
    omer avatar
    9 posts
    Registered:
    19 Jul 2012
    15 Jan 2010
    Link to this post
    hi Ivan
    i use
    ~/Home.aspx as DestinationPageUrl
    do i need another format to redirect to home page like
    ~/tr/Home.aspx or ~/en/Home.aspx  ?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    15 Jan 2010
    Link to this post
    Hello omer,

    Try using QueryString this will append the culture in the url or get the current culture of the page. Then extend the Logic contorl and read the querystring to redirect your user to the appropriate page. Basically you are setting the DestinationPageUrl  of the Login control dinamically instad of through UI.

    sample code:

    string currentculture = CultureInfo.CurrentUICulture.Name;
            switch (currentculture)
            {
                case "tr":
                    Login1.DestinationPageUrl = "tr url";
                    break;
                case "en":
                    Login1.DestinationPageUrl = "en url";
                    break;
            }

     
    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. omer
    omer avatar
    9 posts
    Registered:
    19 Jul 2012
    17 Jan 2010
    Link to this post
    Thanks for your solution it works
  6. omer
    omer avatar
    9 posts
    Registered:
    19 Jul 2012
    17 Jan 2010
    Link to this post
    But i face to a new problem
    http://www.socialarch.net/Home.aspx?sflang=en
    i have LoginViewControl on my site when i try to login in English
    i see the Turkish login page
    http://www.socialarch.net/newlogin.aspx?ReturnUrl=%2fHome.aspx%3fsflang%3den&sflang=tr
    this is the link that system redirects me
    but it will be
    http://www.socialarch.net/newlogin.aspx?ReturnUrl=%2fHome.aspx%3fsflang%3den&sflang=EN
    how can i fix the LoginViewControl (Login buttons Querystring Language problem)

    when i enter urls with correct querystrings my system works fine but it doesnt matter which language i choose it redirect me to Turkish login screen...

    But at the end when i login it redirect me to the correct languages home page

    but with wrong querysting LoginControl's ASP.net localization doesnt work

    Best Regards
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    17 Jan 2010
    Link to this post
    Hello omer,

    I checked the your page, but there I found only Login, CreateUserWizard and LoginStatus control.You have changed something in the LoginStatus control or somehow you are changing the request. In all cases your ReturnUrl looks "ReturnUrl=%2fnewlogin.aspx%3fsflang%3dtr&sflang=en". I am not able to reproduce this behavior with the default LoginStatus control and standard settings for localization. I suggest that you should check what hass been changed lately at your end. You can also try to replace the "en" with "tr" overrding OnPrerRender and getting the current request.

    Also make sure that you have created newlogin.aspx in Turkish. It seems that on post back the culture QueryString is changed

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. omer
    omer avatar
    9 posts
    Registered:
    19 Jul 2012
    17 Jan 2010
    Link to this post
    here is my webconfig newlogin.aspx
        <authentication mode="Forms"
          <forms name=".ASPNET" loginUrl="~/newlogin.aspx" protection="All" timeout="1440" path="/"/> 
            </authentication> 
    do i have any mistake in here like  path"/"

    this is my LoginViewControl.ascx

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="LoginViewControl.ascx.cs" 
        Inherits="UserControls_FinalLoginControls_LoginViewControl" %> 
    <asp:LoginView ID="LoginView1" runat="server"
        <LoggedInTemplate> 
        <p> 
            <asp:Literal ID="UserLabel" runat="server" meta:resourcekey="UserLabelResource1"  ></asp:Literal> 
            <strong><asp:LoginName ID="LoginName" runat="server" /></strong
            ( <asp:LoginStatus ID="LoginStatus1" runat="server" meta:resourcekey="LoginStatus2Resource1" LogoutPageUrl="~/Default.aspx" /> ) 
        </p> 
        </LoggedInTemplate> 
        <AnonymousTemplate> 
            <p> 
                <asp:LoginStatus ID="LoginStatus2" runat="server" meta:resourcekey="LoginStatus2Resource1" /> 
            </p> 
        </AnonymousTemplate> 
    </asp:LoginView> 
     

    this is my LoginViewControl.ascx.cs

    using System.Web.UI; 
    using System; 
    using System.Web.UI.WebControls; 
     
    public partial class UserControls_FinalLoginControls_LoginViewControl : UserControl 
        public LoginView loginView 
        { 
            get 
            { 
                return this.LoginView1; 
            } 
            set 
            { 
                LoginView1 = value
            } 
        } 
     

    nothing in my code its default control nothing modified
    as in web config same

    <add name="Login" section="Login" url="~/Sitefinity/UserControls/Login/LoginControl.ascx" 
         description="Provides user interface (UI) elements for logging in to a Web site." /> 

    but i want to ask something this is my localization code in webconfig

        <localization defaultProvider="Sitefinity" persistenceMode="QueryString" defaultCulture="en" cultures="en, tr"
                <providers> 
                    <clear/> 
                    <add name="Sitefinity" type="Telerik.Localization.Data.DefaultProvider, Telerik.Localization.Data" connectionStringName="DefaultConnection"/> 
                </providers> 
            </localization> 

    do i have any mistake in here ? like autoSetClientLanguage="false" do i need this ?
    to sum up i dont modify any code
    P.S : i have both english and turkish newlogin.aspx
    thanks for your great helps
    best regards
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    18 Jan 2010
    Link to this post
    Hello omer,

    1. Modify the LoginView control template as shown below

    <AnonymousTemplate>
         <p>
             <%--<asp:LoginStatus ID="LoginStatus2" runat="server" />--%>
             <asp:HyperLink runat="server" ID="LoginStatusHyperlink" Text="CustomLogoutHyperLink" />
         </p>
     </AnonymousTemplate>

    2. Add the following code in the code behind of this control

    public void Page_Load(object sender, EventArgs e)
       {
           HyperLink logStatus = LoginView1.FindControl("LoginStatusHyperlink") as HyperLink;
           logStatus.NavigateUrl = HttpContext.Current.Request.RawUrl;
       }



    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  10. omer
    omer avatar
    9 posts
    Registered:
    19 Jul 2012
    18 Jan 2010
    Link to this post
    Server Error in '/' Application. 
     
    Object reference not set to an instance of an object. 
     
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.  
     
    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. 
     
    Source Error:  
     
     
    Line 22:  
    Line 23:             HyperLink logStatus = LoginView1.FindControl("LoginStatusHyperlink") as HyperLink; 
    Line 24:             logStatus.NavigateUrl = HttpContext.Current.Request.RawUrl; 
    Line 25:   
    Line 26:     } 
     
    Source File: c:\Program Files (x86)\Telerik\Sitefinity3.7\WebSites\MSF\Sitefinity\UserControls\Login\LoginViewControl.ascx.cs    Line: 24  
     
    Stack Trace:  
     
     
    [NullReferenceException: Object reference not set to an instance of an object.] 
       UserControls_FinalLoginControls_LoginViewControl.Page_Load(Object sender, EventArgs e) in c:\Program Files (x86)\Telerik\Sitefinity3.7\WebSites\MSF\Sitefinity\UserControls\Login\LoginViewControl.ascx.cs:24 
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +24 
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +41 
       System.Web.UI.Control.OnLoad(EventArgs e) +131 
       System.Web.UI.Control.LoadRecursive() +65 
       System.Web.UI.Control.AddedControl(Control control, Int32 index) +349 
       Telerik.Cms.Web.InternalPage.AddPageControls(IPageContent pageContent, Dictionary`2 placeHolders) +452 
       System.Web.UI.Control.EnsureChildControls() +145 
       System.Web.UI.Control.PreRenderRecursiveInternal() +60 
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3393 

    i got this error when i login admin panel
    on the other hand when i modify the code
    i was unable to see login button and no redirect to login page
    i add the exactly the same code that you give
    i will give you a ftp username and password if you would like to look in visual studio
    best regards
    thanks for your helps
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    18 Jan 2010
    Link to this post
    Hi omer,

    The error is clear. The Hyperlink is null because when you are logged in, you are not in the anonymous template anymore.

    change the code by adding if loop.

    HyperLink logStatus = LoginView1.FindControl("LoginStatusHyperlink") as HyperLink;
    if (logStatus != null)
    {
        logStatus.NavigateUrl = HttpContext.Current.Request.RawUrl;
    }


    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  12. omer
    omer avatar
    9 posts
    Registered:
    19 Jul 2012
    18 Jan 2010
    Link to this post
    yes it works fine but it doesnt goes to
    http://www.socialarch.net/newlogin.aspx

    also i do this but
             <asp:HyperLink runat="server" ID="LoginStatusHyperlink" Text="Login" NavigateUrl="http://www.socialarch.net/newlogin.aspx" />

    doesnt matter the link works fine but login button doesnt point http://www.socialarch.net/newlogin.aspx

    but when i test the button in
    http://www.socialarch.net/newlogin.aspx?sflang=en
    it works great but in home.aspx of course it doesnt work

    Omer Ozsoy
  13. omer
    omer avatar
    9 posts
    Registered:
    19 Jul 2012
    19 Jan 2010
    Link to this post
    Here is the solution

      protected void Page_Load(object sender, EventArgs e) 
        { 
             
                HyperLink logStatus = LoginView1.FindControl("LoginStatusHyperlink") as HyperLink; 
                if (logStatus != null) 
                { 
                    string gelen = (HttpContext.Current.Request.RawUrl); 
                    logStatus.NavigateUrl = gelen.Replace("Home","newlogin"); 
                     
                } 
      
        } 
     

Register for webinar
13 posts, 0 answered