• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 366
  • Last Modified:

asp.net 3.5 login control error with url rewrite


I am using a rewrite rule for my asp.net 3.5 website hosted on iis7 and the main public pages are all based on one master page that contains a login control.  The url rewrite removes the "www.", ".aspx" and adds a trainling slash "/" to each page


the login control works on all pages that have the domain "mysite.com/anypage/",but the home page "mysite.com" the login control does not work.  The login control is in the master page so the code does not change, but I cannot figure out why this will not work on the default page.

what makes this more difficult is that there is no error message and I have custom error handling, no error is being thrown, it does not log the user in, it just posts back to the main page with no change, no redirect to login destination page.

here is my login control:
<asp:Login ID="logRegent" runat="server" CssClass="LogControl" 
                                        PasswordRecoveryUrl="~/password.aspx" TitleText="E-REQUEST Login" 
                                        UserNameLabelText="User:" PasswordRecoveryText="Forgot Password" 
                                    MembershipProvider="RGT_MembershipProvider" >
                                    <CheckBoxStyle CssClass="LogRemember" />
                                    <TextBoxStyle Width="110px" />
                                    <InstructionTextStyle CssClass="LogLable" />
                                    <LabelStyle CssClass="LogLable" />
                                    <FailureTextStyle CssClass="LogError" />
                                    <TitleTextStyle CssClass="LogTitle" />
                                    <HyperLinkStyle CssClass="LogLink" />                            

Open in new window

any help would be appreciated.
  • 2
1 Solution
jordankingAuthor Commented:
i have found some references online that extensionless root urls break the form submit from the master page because the form gets its action attribute from the content page of the masterpage.


  So i am trying to set the action attribute of the containing form on the master page from the content page, but am having trouble.
jordankingAuthor Commented:
half a day later and i figured it out.  I was right bout the previous post, in so much as I had a feeling the form action was not being set properly due to the url rewrite removing the default.aspx.  I tried dozens of ways of setting the form action and differnt settings for the action attribute itself.  Here is what i finally came up with, and it works on all pages:

i put this in the page load of the master page

Dim Context As HttpContext
        Context = HttpContext.Current

        If Context.Request.RawUrl = "/default.aspx" Then
            frmRegent.Action = "/default/" ''in accordance with the rewrite rules i set up
        End If

Open in new window


Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now