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

asp.net 3.5 login control error with url rewrite

hello,

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
ie:
               http://www.mysite.com/anypage.aspx      
becomes
                http://mysite/anypage/

and
                 http://www.mysite.com/default.aspx  
becomes
                 http://mysite.com/

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" 
                                        DestinationPageUrl="http://mysite.com/Erequest/erequest.aspx" 
                                        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" />                            
                                </asp:Login>

Open in new window


any help would be appreciated.
0
jordanking
Asked:
jordanking
  • 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.

http://stackoverflow.com/questions/5136335/how-to-force-to-default-aspx-instead-of-www-domain-com

  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.
0
 
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

0

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