Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #21 (permalink)  
Old August 3rd, 2012, 03:35 AM
Imar's Avatar
Wrox Author
Points: 71,768, Level: 100
Points: 71,768, Level: 100 Points: 71,768, Level: 100 Points: 71,768, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,033
Thanks: 80
Thanked 1,582 Times in 1,559 Posts
Default

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

__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #22 (permalink)  
Old August 3rd, 2012, 09:34 AM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

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=&quot;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&quot;" 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...
Reply With Quote
  #23 (permalink)  
Old August 4th, 2012, 01:16 AM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

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.
Reply With Quote
  #24 (permalink)  
Old August 4th, 2012, 05:06 AM
Imar's Avatar
Wrox Author
Points: 71,768, Level: 100
Points: 71,768, Level: 100 Points: 71,768, Level: 100 Points: 71,768, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,033
Thanks: 80
Thanked 1,582 Times in 1,559 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #25 (permalink)  
Old August 4th, 2012, 05:31 AM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Quote:
Originally Posted by Imar View Post
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...
Reply With Quote
  #26 (permalink)  
Old August 4th, 2012, 05:49 AM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

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
Reply With Quote
  #27 (permalink)  
Old August 4th, 2012, 07:54 AM
Imar's Avatar
Wrox Author
Points: 71,768, Level: 100
Points: 71,768, Level: 100 Points: 71,768, Level: 100 Points: 71,768, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,033
Thanks: 80
Thanked 1,582 Times in 1,559 Posts
Default

>> 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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #28 (permalink)  
Old August 4th, 2012, 07:55 AM
Imar's Avatar
Wrox Author
Points: 71,768, Level: 100
Points: 71,768, Level: 100 Points: 71,768, Level: 100 Points: 71,768, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,033
Thanks: 80
Thanked 1,582 Times in 1,559 Posts
Default

>> 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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #29 (permalink)  
Old August 4th, 2012, 11:42 AM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Quote:
Originally Posted by Imar View Post
>> 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....
Reply With Quote
  #30 (permalink)  
Old August 4th, 2012, 01:33 PM
Imar's Avatar
Wrox Author
Points: 71,768, Level: 100
Points: 71,768, Level: 100 Points: 71,768, Level: 100 Points: 71,768, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,033
Thanks: 80
Thanked 1,582 Times in 1,559 Posts
Default

>>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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing Connection String in web.config TeaDrinkingGeek BOOK: Beginning ASP.NET 4 : in C# and VB 1 March 14th, 2011 10:42 AM
connection string issues, web.config file issues kaliaparijat ASP.NET 2.0 Professional 1 June 12th, 2008 08:07 AM
setting connection string in the web.config ACE2084 ADO.NET 2 January 6th, 2005 03:33 PM
Database Connection with Web.Config RPG SEARCH Classic ASP Databases 7 July 26th, 2004 06:10 PM
Variable Path in web.Config Connection String? ElPato General .NET 4 June 21st, 2004 05:44 PM



All times are GMT -4. The time now is 10:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.