When I run the page loacl on my computer everything works fine. But when I upload it on a server and test it, I get error on "MyProfile.aspx" page. This is how the error message looks like:
Server Error in '/' Application.
--------------------------------------------------------------------------------
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 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.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Source Error:
Line 106: End Get
Line 107: Set
Line 108: Me.SetPropertyValue("CompanyId", value)
Line 109: End Set
Line 110: End Property
Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\root\02a504ec\49b021f4\App_Code.wbml5gsb.1.v b Line: 108
Stack Trace:
[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) +800131
System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) +186
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +737554
System.Data.SqlClient.SqlInternalConnectionTds.Att emptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +114
System.Data.SqlClient.SqlInternalConnectionTds.Log inNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +421
System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181
System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +173
System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +133
System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +30
System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnection owningObject) +424
System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection owningObject) +494
System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
System.Web.DataAccess.SqlConnectionHolder.Open(Htt pContext context, Boolean revertImpersonate) +84
System.Web.DataAccess.SqlConnectionHelper.GetConne ction(String connectionString, Boolean revertImpersonation) +197
System.Web.Profile.SqlProfileProvider.GetPropertyV aluesFromDatabase(String userName, SettingsPropertyValueCollection svc) +782
System.Web.Profile.SqlProfileProvider.GetPropertyV alues(SettingsContext sc, SettingsPropertyCollection properties) +428
System.Configuration.SettingsBase.GetPropertiesFro mProvider(SettingsProvider provider) +404
System.Configuration.SettingsBase.SetPropertyValue ByName(String propertyName, Object propertyValue) +170
System.Configuration.SettingsBase.set_Item(String propertyName, Object value) +89
System.Web.Profile.ProfileBase.SetInternal(String propertyName, Object value) +139
System.Web.Profile.ProfileBase.set_Item(String propertyName, Object value) +71
System.Web.Profile.ProfileBase.SetPropertyValue(St ring propertyName, Object propertyValue) +8
ProfileCommon.set_CompanyId(String Value) in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\root\02a504ec\49b021f4\App_Code.wbml5gsb.1.v b:108
MyProfile.btnSave_Click(Object sender, EventArgs e) in D:\hshome\workidoo\workidoo.com\MyProfile.aspx.
vb: 37
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
I use asp.net profile propeties and believe it is somewhere in the Web.config file that I have done wrong. This is how the code behinde looks like on "MyProfile.aspx" -page:
Partial Class MyProfile
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
txtCompanyId.Text = Profile.CompanyId
txtCompanyName.Text = Profile.CompanyName
txtImage.Text = Profile.Image
txtAdress.Text = Profile.Adress
txtPostalCode.Text = Profile.PostalCode
txtCity.Text = Profile.City
txtPhoneNumber.Text = Profile.PhoneNumber
txtFaxNumber.Text = Profile.FaxNumber
txtEmail.Text = Profile.Email
txtHomePageAdress.Text = Profile.HomePageAdress
txtAbout.Text = Profile.About
End If
Dim dtNow As Date = DateTime.Now
Using db As New workidooDataContext
Dim TotalWork = (From s In db.Works _
Select s).Count
Dim TotalWorkToday = (From s In db.Works _
Where s.Createt = Today _
Select s.Createt).Count
lblTotalWork.Text = TotalWork
lblTotalWorkToday.Text = TotalWorkToday
End Using
End Sub
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
If Page.IsValid Then
Profile.CompanyId = txtCompanyId.Text
Profile.CompanyName = txtCompanyName.Text
Profile.Image = txtImage.Text
Profile.Adress = txtAdress.Text
Profile.PostalCode = txtPostalCode.Text
Profile.City = txtCity.Text
Profile.PhoneNumber = txtPhoneNumber.Text
Profile.FaxNumber = txtFaxNumber.Text
Profile.Email = txtEmail.Text
Profile.HomePageAdress = txtHomePageAdress.Text
Profile.About = txtAbout.Text
End If
End Sub
End Class
If I comment the entire code inside "If End" under Page_Load Sub, the page will loaded without problems, the same thing is abolut code below Sub btnSave_Click, I get also the same error when I click the save button.
Plz Help me!
http://www.workidoo.com