Added extra fields to the profile membership.

When I tried to login it gives me an error with the new user I created. If I try to login with older user account then I can log in properly.

Server Error in '/' Application.
--------------------------------------------------------------------------------

The 'src' property had a malformed URL: Cannot use a leading .. to exit above the top directory..
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.Web.HttpException: The 'src' property had a malformed URL: Cannot use a leading .. to exit above the top directory..

Source Error:


Line 40:             <div class="header">
Line 41:                 <div class="header-logo">
Line 42:                     <a href="<%=Page.ResolveUrl("~/Default.aspx")%>" class="logo">&nbsp; </a>
Line 43:                 </div>
Line 44:                 <div class="header-login">
 

Source File: c:\inetpub\wwwroot\OmegaLove.Web\OmegaLove.Web\MasterPages\Root.Master    Line: 42

Stack Trace:
omegaloveAsked:
Who is Participating?
 
mziterCommented:
The error sounds like somehow you are attempting to go back too far in your path. Something like what would happen if you typed:

cd ..

at a C:\ prompt or / prompt
0
 
StealthyDevCommented:
Sorry omegalove,

You need to give us what exactly you are trying to do?

I think you are keeping your create user page in someother folder other than the folder in which Default.aspx is?

If so, give the correct path?

Regards.
0
 
omegaloveAuthor Commented:
why when i login with an old user it works.

0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
StealthyDevCommented:
Please explain us the scenario.

for example,
1. you are going to myproject/registration/newmember.aspx to create a new user
2. in that page, you are redirecting the user to myproject/Default.aspx
  for registered user,
3. you are in myproject/login/login.aspx
4. on successful login, you are redirecting the user to myproject/Default.aspx

Please revert
0
 
omegaloveAuthor Commented:
I created the user through a register page with a profile set in the web config file.

  public partial class ctrlLogin : OmegaLoveBasePageUserControl
    {
        protected MembershipUser loginUser;
        protected void Page_Load(object sender, EventArgs e)
        {
           

            if (!IsPostBack)
            {
                // Search recursively for a Login control, called LoginStatus
                // starting from within the Page object.
                Login curLogin = FindControl<Login>(this, "LoginStatus");

                // You still should check whether you got something back!
                if (curLogin != null)
                    Page.SetFocus(curLogin.FindControl("UserName"));
            }
        }
   
        // Search recursively a control sub-tree for a specific control.
        // It searches every control in the sub-tree, so it potentially
        // could be optimized to search only, say, INamingContainers.
        public Control FindControlRecursive(Control root, string id)
        {
            if (root.ID == id) return root;
            foreach (Control c in root.Controls)
            {
                var ctlFound = FindControlRecursive(c, id);
                if (((ctlFound != null))) return ctlFound;
            }
            return null;
        }

        public T FindControl<T>(string id) where T : Control
        {
            return FindControl<T>(Page, id);
        }

        public static T FindControl<T>(Control startingControl, string id) where T : Control
        {
            T found = null;
            foreach (Control activeControl in startingControl.Controls)
            {
                found = activeControl as T;
                if (found == null)
                {
                    found = FindControl<T>(activeControl, id);
                }
                else if (string.Compare(id, found.ID, true) != 0)
                {
                    found = null;
                }
                if (found != null)
                {
                    break;
                }
            }
            return found;
        }


        protected void btnLogout_Click(object sender, EventArgs e)
        {

            this.Context.Session.Clear();
            this.Context.Session.Abandon();

            FormsAuthentication.SignOut();
            FormsAuthentication.RedirectToLoginPage();
            Response.Redirect(FormsAuthentication.LoginUrl);

        }
     

        protected void LoginStatus_Authenticate(object sender, AuthenticateEventArgs e)
        {
            var lgnMain = ((Login)LoginView1.FindControl("LoginStatus"));
            string username = lgnMain.UserName;
            if (Membership.ValidateUser(lgnMain.UserName, lgnMain.Password))
            {
                FormsAuthentication.RedirectFromLoginPage(lgnMain.UserName, false);
                Response.Redirect("~/Secure/UserProfile.aspx", false);

            }
            else
            {
                lgnMain.FailureText = "Your login attempt was not successful. Please try again.";
                Image ImageError = new Image();
                ImageError = ((Image)LoginView1.FindControl("LoginStatus").FindControl("ImageError"));
                ImageError.Visible = true;
               
            }
            MembershipUser usrInfo = Membership.GetUser(lgnMain.UserName);

            if (usrInfo != null)
            {
                //  Is this user locked out?
                if (usrInfo.IsLockedOut)
                {
                    lgnMain.FailureText = "Your account has been locked out because of too many invalid login attempts. Please contact the admin" +
                    "istrator to have your account unlocked.";
                }
                else if (!usrInfo.IsApproved)
                {
                    lgnMain.FailureText = "Your account has not yet been approved. You cannot login until an administrator has approved your acc" +
                    "ount.";
                }
            }
        }

        protected void ImgRegister_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("~/Secure/Register.aspx");
        }
0
 
StealthyDevCommented:
Can you tell me in which page the attached code is in?

i mean, <project>/Secure/SomePage.aspx



Source Error:


Line 40:             <div class="header">
Line 41:                 <div class="header-logo">
Line 42:                     <a href="<%=Page.ResolveUrl("~/Default.aspx")%>" class="logo">&nbsp; </a>
Line 43:                 </div>
Line 44:                 <div class="header-login">

Open in new window

0
 
omegaloveAuthor Commented:
<asp:LoginView ID="LoginView1" runat="server">
    <AnonymousTemplate>
        <asp:Login ID="LoginStatus" RememberMeSet="false" runat="server" Height="30px" Width="100%"
            DestinationPageUrl="~/Secure/UserProfile.aspx" OnAuthenticate="LoginStatus_Authenticate">
            <LayoutTemplate>
                <table border="0" cellpadding="0" cellspacing="0" width="100%"
                    style="height: 90px">
                    <tr>
                        <td nowrap="nowrap" width="25%">
                            <img id="UHorLogin1_Image2" src="../Images/Icons/login1.gif" style="height: 25px;
                                width: 25px; border-width: 0px;" align="middle" /><asp:Label runat="server" ID="lblUserName"
                                    AssociatedControlID="UserName" Text="Username:" />&nbsp;
                            <asp:TextBox ID="UserName" runat="server" BorderColor="DarkGray" BorderStyle="Inset"
                                BorderWidth="2px" Width="105px" />&nbsp;
                        </td>
                        <td width="9px" style="text-align: left;" valign="middle">
                            <asp:RequiredFieldValidator ID="valRequireUserName" runat="server" SetFocusOnError="True"
                                ControlToValidate="UserName" Text="*" ValidationGroup="Login" Font-Bold="True" />
                        </td>
                        <td nowrap="nowrap" width="25%">
                            <img id="UHorLogin1_Image1" src="../Images/Icons/passwordsmall.gif" style="border-width: 0px;"
                                align="middle" />
                            <asp:Label ID="lblPassword" runat="server" AssociatedControlID="Password" Text="Password:" />&nbsp;
                            <asp:TextBox ID="Password" runat="server" TextMode="Password" BorderColor="DarkGray"
                                BorderStyle="Inset" BorderWidth="2px" Width="105px" />&nbsp;
                        </td>
                        <td width="9px" style="text-align: left;" valign="middle">
                            <asp:RequiredFieldValidator ID="valRequirePassword" runat="server" ControlToValidate="Password"
                                SetFocusOnError="True" Text="*" ValidationGroup="Login" Font-Bold="True" />
                        </td>
                        <td width="25%">
                            <asp:Button CssClass="button-login" ValidationGroup="Login" CommandName="Login" ID="btnLogin"
                                runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td width="100%" colspan="5" style="text-align: right;">
                            <asp:ImageButton ID="ImgRegister" runat="server" ImageUrl="../Images/Buttons/newsletter_button.gif"
                                ImageAlign="Top" OnClick="ImgRegister_Click" />&nbsp;
                            <asp:HyperLink ID="lnkPasswordRecovery" runat="server" NavigateUrl="~/Secure/PasswordRecovery.aspx">Forgot
                                password?</asp:HyperLink>&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td width="100%" colspan="5" style="text-align: right;">
                            <input type="text" name="theTime" size="30" readonly="readonly" style="border: 0px;
                                background-image: none; margin-left: 4px; font-weight: bold;">
                        </td>
                    </tr>
                    <tr>
                        <td width="100%" colspan="5" style="text-align: right;">
                            <asp:Image ID="ImageError" runat="server" Width="22px" Height="16px" ImageAlign="Top"
                                src="../Images/Icons/alert.gif" Visible="false" />
                            <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
                        </td>
                    </tr>
                </table>
            </LayoutTemplate>
        </asp:Login>
    </AnonymousTemplate>
    <LoggedInTemplate>
        <div id="welcomebox">
            <asp:LoginName ID="LoginName1" runat="server" FormatString=" Welcome {0} " />
            <asp:Button CssClass="button-logout" ID="btnLogout" runat="server" OnClick="btnLogout_Click" /><br />
            <input type="text" name="theTime" size="30" readonly="readonly" style="border: 0px;
                background-image: none; margin-left: 4px; font-weight: bold;">
        </div>
    </LoggedInTemplate>
</asp:LoginView>
0
 
omegaloveAuthor Commented:
I changed this in the web.config
 

   <profile defaultProvider="OmegaLoveProfileProvider" inherits="OmegaLove.BLL.CustomProfile">
      <providers>
        <add name="OmegaLoveProfileProvider" type="System.Web.Profile.SqlProfileProvider" applicationName="Omegalove.Web" connectionStringName="LocalSqlServer" />
      </providers>
    </profile>

<profile defaultProvider="OmegaLoveProfileProvider" inherits="OmegaLove.BLL.CustomProfile">
      <providers>
        <add name="OmegaLoveProfileProvider" type="System.Web.Profile.SqlProfileProvider" applicationName="/" connectionStringName="LocalSqlServer" />
      </providers>
    </profile>
0
 
omegaloveAuthor Commented:

    <membership defaultProvider="OL_MembershipProvider" userIsOnlineTimeWindow="40">
      <providers>
        <add name="OL_MembershipProvider" connectionStringName="LocalSqlServer" applicationName="/" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" passwordFormat="Encrypted" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </providers>
    </membership>

    <!--<profile defaultProvider="OL_ProfileProvider">
      <providers>
        <clear />
        <add name="OL_ProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" />
      </providers>
      <properties>
        <add name="Address" type="OmegaLove.BLL.Address"/>
        <add name="Personal" type="OmegaLove.BLL.Personal"/>
        <add name="Preferences" type="OmegaLove.BLL.Preferences"/>
      </properties>
    </profile>-->

    <profile defaultProvider="OmegaLoveProfileProvider" inherits="OmegaLove.BLL.CustomProfile">
      <providers>
        <add name="OmegaLoveProfileProvider" type="System.Web.Profile.SqlProfileProvider" applicationName="/" connectionStringName="LocalSqlServer" />
      </providers>
    </profile>
this needs to be set in one of the tables.
0
 
omegaloveAuthor Commented:
Yes but it worked with until I adding extra fields in the Personal.cs

So it seems like it is pointing to the wrong applicationname

When I register a new user in my registration page.

Goto omegalove. and click on register than try to login.
0
 
omegaloveAuthor Commented:
k
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.