Using ASP.NET 2.0 Login Control gives me error: 26 - Error Locating Server/Instance Specified

Discussion in 'ASP.NET 2.0' started by wisemx, Jul 25, 2008.

  1. Hi,
    First thing, Access is not a Data Server, it can't be used as one but...
    You can of course use it as a Data file.
    I always recommend Access connection strings are not used in the web.config because it's messy.
    You can however do it there but you have to use a data directory source method.
    The methods for this are illustrated here:
    http://www.connectionstrings.com/?carrier=access
    (Last one on that page...)

    And here for Access 2007:
    http://www.connectionstrings.com/?carrier=access2007

    From my own experience it is a lot easier to use Access from the pages.
    If you want to do ASP.NET Membership without SQL Server I'drecommend XML.
    You can find a lot of examples on-line.
    Salute,
    Mark
     
  2. I just wanted to post this as reference for how I have the ConnectionString referenced on pages;


    <asp:SqlDataSource ID="dsGridView1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"


    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"


    SelectCommand="SELECT stuff FROM [ths table] ORDER BY something" DataSourceMode="DataReader">


    </asp:SqlDataSource>

    Like I said, connecting hasn't been a problem, it works great, I'm completely satisfied with the stability and speed the app achieves. I can zoom around the site flipping through pages, editting records, the DASP servers definitely seem up to the task.If I had to change the physical path to the database (such as moving it from App_Data locally to _database online with DASP), I only had to change one line of code as opposed to dozens of declarations across dozens of pages.

    Anyways, I will continue to search for what I am doing incorrectly to make the standard Login control in ASP.NET 2.0 function properly online as it does locally. Maybe my directory structure is at fault, or I haven't added a required service to my account, or maybe I'm just braindead and overlooking something obvious.




    <asp:Login ID="Login1" runat="server" DestinationPageUrl="~/overhere.aspx" >


    ...


    <asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="ctl02$Login1" />


    </asp:Login>
    When you click the login button, I imagine the reason I'm getting the error: 26 is that the App_Data folder that contains the User/Roles ASPNETDB.MDF does not exist, orI havenot setup my DASP account properly (simply uploading App_Data won't work), or I need to modifysomething (machine.config?)other than the connection string,or is trying to reference locally something that is online, or ?


    PS - I have found this forum extremely useful in general ASP matters and DASP specific issues. I hope everyone keeps posting their solutions as well as their questions, it is an excellent knowledge base.
     
  3. I created an app using VWD2005 and an Access database, andmanaged to upload my files and set the connection string with relative ease, due mostly to the information in this forum.




    <connectionStrings>



    <add name="ConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\web\*****\htdocs\_database\*******.mdb;Persist Security Info=True;Jet OLEDB:Database Password=*******" providerName="System.Data.OleDb" />


    </connectionStrings>


    Everything works great, except for the login control. It is the basic plug and play login control, and works great locally with the users and roles I set up, but gives me an


    error: 26 - Error Locating Server/Instance Specified


    when I try to use it online. Locally an App_Data folder is created which stores the ASPNETDB.MDF file, so I uploaded that too to see if it would work. No luck...


    Before I start going in the wrong direction, can anyone point out something obvious I may be doing wrong, or offer some advice?





    Also, I considered just using the Permission Manager settings to prevent anonymous users, and set the read/write permissions to deny for the required directory. This did make a login popup appear,but after a few cancels the login popup simply went away and I was able to continue browsing the site.
     
  4. http://weblogs.asp.net/scottgu/archive/2006/04/22/Always-set-the-_2200_applicationName_2200_-property-when-configuring-ASP.NET-2.0-Membership-and-other-Providers.aspx


    http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/security/CreatingUsers.src&amp;file=membershiproles_vb\Web.config&amp;lang=VB+Source
    the short and skinny:

    - need to add a connectionstring to the membership database (makes sense), but the path below needs to be modified

    <add name="ASPNETDB" connectionString="Server=(local)\SQLExpress;Integrated Security=SSPI;Database=aspnetdb"/>

    - need to set the applicationName

    <membership defaultProvider="MembershipSqlProvider" userIsOnlineTimeWindow="15">
    <providers>
    <add
    name="QuickStartMembershipSqlProvider"
    type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    connectionStringName="ASPNETDB"
    enablePasswordRetrieval="false"
    enablePasswordReset="true"
    requiresQuestionAndAnswer="true"
    applicationName="SecurityQuickStart"
    requiresUniqueEmail="true"
    passwordFormat="Hashed"
    applicationName="something?"/>
    </providers>
    </membership>

    am I getting closer, or spinning my wheels?
     
  5. Hi,
    Don't let it seem like I'm not trying to help, honestly I am. [​IMG]

    Looks like now you are confusing an Express DB with an Access DB.

    You absolutely cannot connect to an Express DB here in your remote site.
    You can however work on it locally and then use multiple methods to get the records on-line.

    I suppose you can use an Access DB for the Membership controls, it should be possible.
    The problem I have with it is persistence.
    In ASP.NET you have a 2-way connection to your SQL Server connection.

    As for Scott's article, yes the Application name has been a hot issue.

    Lemme know how I can help, minus any stress I'm sending your way. [​IMG]
    Salute,
    Mark
     
  6. No, I do appreciate any help, don't think otherwise.

    My application database itself is Access, simple to develop and modify, perfect for a single user app (MYAPP.MDB).

    The membership database is seperate and in SQL Express format as you said whichVWD2005 creates by default when you use the Web Site Administration Tool(ASPNETDB.MDF).

    I'm sure other DASP users, especially those uploading the ASP starter kits, don't build their own custom login controls/membership databases. I'm sure they are using the VWD2005 Web Site Administration Tool to set their security, users, roles, etc. So here is my question; Is everyone herecreating custom login code behind and creating sql, access or xml membership databases to handle their security or is there something I haven't found in this forum yet? All I've read is people having problems with it.

    What is the point of the built-in security available in ASP.NET 2.0 if you can't use it online? My app works better than expected, which is great, but because I can't secure it as anticipated I had to remove it from the servers until I can figure this out, which is bullshit.

    *sigh*
     

Share This Page