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

August 3rd, 2012, 03:35 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
BTW, this:
Quote:
|
System.Web.Management.SqlServices.GetSqlConnection (String server, String user, String password, Boolean trusted, String connectionString) +137 System.Web.Management.SqlServices.SetupApplication Services(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +94 System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +27 System.Web.DataAccess.SqlConnectionHelper.CreateMd fFile(String fullFileName, String dataDir, String connectionString) +395
|
may suggest that ASP.NET tries to configure ASP.NET Membership which in turn means it may be looking for the default LocalSqlServer connection string which in turn means that /Menber could be a separate application in IIS with its own we.config file and settings....
Cheers,
Imar
|
|

August 3rd, 2012, 09:34 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Quote:
|
So, as asked before, please be specific. Tell us if /Member is just a folder or a configured application, shows us the relevant code for the page behind /Member, tells us what you expect to fire and when etc....
|
Hi Imar, first of all thank you for looking at site.
I uploaded all the files on server as is, Member is a folder containing web.config to restrict unauthorized users.
Root web.config--
Code:
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="8" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="20" passwordStrengthRegularExpression="" />
</providers>
</membership>
<location path="Manage">
<system.web>
<authorization>
<allow roles="Managers" />
<deny users="*" />
</authorization>
</system.web>
</location>
<location path="Member">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
<connectionStrings>
<add name="ASPNETDBEntities" connectionString="metadata=res://*/App_Code.ProOnline.csdl|res://*/App_Code.ProOnline.ssdl|res://*/App_Code.ProOnline.msl;provider=System.Data.SqlClient;provider connection string="workstation id=PropOnline.mssql.somee.com;packet size=4096;user id=******;pwd=******;data source=PropOnline.mssql.somee.com;persist security info=False;initial catalog=PropOnline;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
<add name="ConnectionString" connectionString="workstation id=PropOnline.mssql.somee.com;packet size=4096;user id=******;pwd=******;data source=PropOnline.mssql.somee.com;persist security info=False;initial catalog=PropOnline" providerName="System.Data.SqlClient" />
</connectionStrings>
Member/web.config --
Code:
<?xml version="1.0"?>
<configuration>
<system.web>
<authorization>
<allow roles="Managers,Members"/>
<deny users="?" />
</authorization>
</system.web>
</configuration>
Member/Default.aspx.cs --
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using ASPNETDBModel;
public partial class Member_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
using (ASPNETDBEntities myEntities = new ASPNETDBEntities())
{
Guid userId = (Guid)Membership.GetUser().ProviderUserKey;
var albums = (from a in myEntities.Albums
where a.UserId == userId
select a).Count().ToString();
var clients = (from c in myEntities.Clients
where c.DealerId == userId
select c).Count().ToString();
lblAlbums.Text = albums;
lblClients.Text = clients;
}
}
}
I hope this is information what you need...
|
|

August 4th, 2012, 01:16 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Hi jdlferreira,
can you tell me
1. How many databases did you manage, 1 or 2?
2. If 2 then how? as webhost only allows 1 database.
3. Where and How you created your database(s)?
4. Can you post Membership provider setting which is in web.config?
Many thanks
Last edited by sophia; August 4th, 2012 at 01:21 AM..
|
|

August 4th, 2012, 05:06 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
I can't see a problem with your setup. Maybe ASPNETDBEntities is using a different connection string after all? Is ita standard EF Database First model? Could there be code in the model classes that changes the connection string?
Imar
|
|

August 4th, 2012, 05:31 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Quote:
Originally Posted by Imar
Hi there,
I can't see a problem with your setup. Maybe ASPNETDBEntities is using a different connection string after all? Is ita standard EF Database First model? Could there be code in the model classes that changes the connection string?
Imar
|
I do not know how to check all these what you have stated. But one thing to note is that same production string is working on local site, if it is working on local site then why it is giving error on server?
it is really becoming tedious...
|
|

August 4th, 2012, 05:49 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Ok leaving this host, can you please tell me the free host which provides latest .net technologies, for demo purpose. or just the ms sql 2008 hosting?
Thanks
|
|

August 4th, 2012, 07:54 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
>> can you please tell me the free host which provides latest .net technologies, for demo purpose. or just the ms sql 2008
Nope, don't know of any such host. I doubt that there are free hosters offering SQL Server.
Imar
|
|

August 4th, 2012, 07:55 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
>> I do not know how to check all these what you have stated
In that case, I can't be of much help. Sorry.
Imar
|
|

August 4th, 2012, 11:42 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Quote:
Originally Posted by Imar
>> I do not know how to check all these what you have stated
In that case, I can't be of much help. Sorry.
Imar
|
Sorry??? I need your help....
|
|

August 4th, 2012, 01:33 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
>>Sorry??? I need your help....
Sure, but like I said: I can't help (much). Everything looks good, so it must be something on the server I am not seeing or you're not telling. You'll need to figure this out with some analysis on the server, starting with a bare bones site, adding stuff back in until it breaks. Also, maybe your host can help as well.
I can't do much from the outside...
Cheers,
Imar
|
|
 |
|