Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ricardo 24 posts 56 karma points
    Feb 16, 2011 @ 12:22
    Ricardo
    0

    Umbraco switching to https and calling a code behind event on login

    Have the below code to switch requests from ‘http’ to ‘https’ when user clicks on a button. This is to protect user/password info before it is sent to the server. In the server, should call the code behind associated to the button but is not doing it. On pages that are NOT under Umbraco this code works fine.

     

    Control:

          <asp:ImageButton ID="btnLogin" runat="server" OnClick="btnLogin_Click" ... />

    Code behind:

    protected void Page_Load(object sender, EventArgs e)

    {

    PostBackOptions pbOptions = new PostBackOptions(btnLogin);

    pbOptions.ActionUrl = Request.Url.ToString().Replace("http://", "https://");

    btnLogin.Attributes.Add("onclick", "this.disabled = true; + Page.ClientScript.GetPostBackEventReference(pbOptions) + ";");

    }

     

    protected void btnLogin_Click(object sender, ImageClickEventArgs e)

          {

    }

     

    If put this code in an Umbraco page, when click on the login button the request changes to ‘https’, page is post to the server but the btnLogin_Click event is NOT called.

     

    Is there something need to change to make this work in Umbraco? Does anybody know a solution / work around to make ‘btnLogin_Click’ to be executed? Or any idea where I can look to find the problem?

    Thanks

  • Ricardo 24 posts 56 karma points
    Mar 10, 2011 @ 13:59
    Ricardo
    0

    The 'WebForm_DoPostBackWithOptions' does not seem to work in Umbraco (at least on this case). To do the 'http' to 'https' change had to trick the call changing 'theForm.action' to https.

  • adarsh 46 posts 66 karma points
    Mar 14, 2011 @ 16:32
    adarsh
    0

    hi there,

    i am having the same problem do any body got the solution for the above problem.

     

Please Sign in or register to post replies

Write your reply to:

Draft