 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

July 4th, 2011, 05:51 PM
|
|
Authorized User
|
|
Join Date: Jun 2011
Posts: 32
Thanks: 22
Thanked 0 Times in 0 Posts
|
|
Login Controls
Implementing security via chapter 16 (Login Controls) was a breeze a home, but now I have uploaded my aspx pages plus database to an external web host.
My current database is working fine, but ASPNETDB.NET does pose the use of a second database.
Using Microsoft Visual Web Developer 2010 Express and SQL Server 2008 Express, had me trying to download SQL Server Management Studio Express 2008. At point #5 on page 762 as I right clicked on Attach, my error messages was "Cannot show requested dialog - Parameter Name nColIndex. Acutal value was -1 (Microsoft.SqlServer.GridControl).
Well, that one lost me and I have tried repeatedly to install SP2 to get Management Studio to work and still get the above error. What if I were to upgrade my web host account to allow 2 databases and just uploaded ASPNETDB.NET? What if I did that as without ASPNETDB.NET I am unable to use the login script from chapter 16? Are there other ways to attach to two databases?
Thanks so much
|
|

July 4th, 2011, 06:05 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Take a look at page 771, the section "Configuring Your Database for the Application Services". It shows you how to use the aspnet_regsql tool to change your own database and add the required asp.net objects to support Membership, Roles etc.
Hope this helps,
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

July 12th, 2011, 01:46 PM
|
|
Authorized User
|
|
Join Date: Jun 2011
Posts: 32
Thanks: 22
Thanked 0 Times in 0 Posts
|
|
Login issue
Hi Imar:
First of all thanks for the quick response to my first question/post.
I did what you suggested on page 771 and after looking at the tables that exist on my remote server, I believe I have what I need for the login issue for the ASPNETDB.MDF being "incorporated" into my single database file.
So using localhost I can login (after creating a new user) and all is well. I am basically following your book, but with my own "variations", but the essence of your code for the PlanetWrox is there. Ok!
My localhost has been changed to use (my connectionsStrings) of my external web host, thus I should be accessing my external host due to the change in connectionStrings from my local computer within Microsoft visual web developer 2010 Express.
....but when I use the actual URL of my external web host (with my Browser and go to the login.aspx page and login) I get the "Server error in '/' Application, server not found" error.
On page 585 it talks about machine.config which is a file I have not "messed" with or uploaded. Does this file need dealing with as well with its connectionString line of code?
I just can't seem to get to my ~/Management/Default.aspx page from my login.aspx page when accessing my external server via Browser, but can from my local host version.
thanks in advance
I know I'm close
Cliff
|
|

July 12th, 2011, 02:12 PM
|
|
Authorized User
|
|
Join Date: Jun 2011
Posts: 32
Thanks: 22
Thanked 0 Times in 0 Posts
|
|
Just checked Management Studio
Hi Imar:
Just check SQL Server Management Studio on my external server and eventhough I appear to have my "localhost version" using the connectionStrings for my external server, the Membership and Users tables are empty!
I then uploaded my login version to "create an account" and tried to login. Still cannot get to my Default.aspx page?
I will later remove the "Sign up" portion as this is one of my variations on your theme, but am using it now for testing
Just trying to give you as much info as I can to find the issue. Thanks for any suggestions.
Cliff
|
|

July 12th, 2011, 02:53 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Cliff,
Quote:
|
but when I use the actual URL of my external web host (with my Browser and go to the login.aspx page and login) I get the "Server error in '/' Application, server not found" error.
|
Maybe your host doesn't allow access to SQL Server remotely? You can trty out the settings using the SQL Server Management Studio (Experess or full).
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

July 12th, 2011, 04:06 PM
|
|
Authorized User
|
|
Join Date: Jun 2011
Posts: 32
Thanks: 22
Thanked 0 Times in 0 Posts
|
|
All from external server
Hi Imar:
So I made the necessary changes to login.aspx and SignUp.aspx and and uploaded them to server.
Now when I try to "Sign Up for a new account" I get the following:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
thanks
Cliff
|
|

July 12th, 2011, 04:22 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Sounds like you're using an incorrect connection string. How does your connection string look? Can you post the code for your web.config?
Also, where did you get the details for the SQL Server you're trying to access? Did your host provide them? Can they help you out with this? (FAQs on their web site for examle).
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

July 12th, 2011, 06:04 PM
|
|
Authorized User
|
|
Join Date: Jun 2011
Posts: 32
Thanks: 22
Thanked 0 Times in 0 Posts
|
|
web.config etc.
My connection string as listed by goDaddy.com is:
esherr01.db.8004918.hostedresource.com
We are using (this was a question I had for godaddy) DSN as opposed to ASP schema
DSN is:
mssql_esherr01.dsn
All of the database material/information came from goDaddy and I have spoken to them several times, they were often less than helpful.
Here is my web.config
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="GolfDatabaseConnectionString1" connectionString="Data Source=esherr01.db.8004918.hostedresource.com; Initial Catalog=esherr01;User ID=esherr01; Password='Bond007';"
providerName="System.Data.SqlClient" />
<add name="GolfDatabaseConnectionString2" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\GolfDatabase.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<customErrors mode="Off" />
<profile>
<properties>
<add name="FirstName"/>
<add name="LastName"/>
</properties>
</profile>
<roleManager enabled="true"/>
<compilation debug="false" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" requiresQuestionAndAnswer="false" minRequiredPasswordLength="6" passwordFormat="Clear"/>
</providers>
</membership>
<authentication mode="Forms" />
</system.web>
<location path="MyProfile.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
</configuration>
|
|

July 13th, 2011, 07:07 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
You may want to take another look at Appendix B, pages 771 and 773 specifically. Your Membership provider is still pointing to LocalSqlServer rather than to one of your "go daddy" connection strings. The section "Overriding the LocalSqlServer Connection String" on page 773 shows you how to fix this.
Cheers,
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

July 13th, 2011, 11:59 AM
|
|
Authorized User
|
|
Join Date: Jun 2011
Posts: 32
Thanks: 22
Thanked 0 Times in 0 Posts
|
|
That did it!
Whew!
Well, pages 773-774 certainly was the key.
What I wound up doing was to add the new connection string for LocalSqlServer as shown at the top of page 773, but pointing to my database.
Then, altered my Membership provider to indicate the correct connectionstringname and "off she went"
Well, now on to my next challenge where with one database I only want to show/work with "members" that were added by login. When simulating this locally I used Profile.Username.
Great book. Thanks for all the help as I appreciate your time. I'm sure there will be a few more postings, but I am trying to do this myself as that's how one learns. Thanks again
Cliff
|
|
 |
|