whats problem in asp.net 2.0

V

Vaidas Gudas

I has web project on virtual pc, maked with framework 2.0. there I was used
the method role.roleexists("admin") and everything was worked good.
but when i replace this project on my local machine, where is installed both
versions 1.1 and 2.0 of framework. And on the this method I am getting the
error
System.Web.HttpException was unhandled by user code
ErrorCode=-2147467259
Message="Unable to connect to SQL Server database."
Source="System.Web"
StackTrace:
at System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String
fullFileName, String dataDir, String connectionString)
at
System.Web.DataAccess.SqlConnectionHelper.EnsureSqlExpressDBFile(String
connectionString)
at System.Web.DataAccess.SqlConnectionHelper.GetConnection(String
connectionString, Boolean revertImpersonation)
at System.Web.Security.SqlRoleProvider.RoleExists(String roleName)
at System.Web.Security.Roles.RoleExists(String roleName)
at Login.Login1_Authenticate(Object sender, AuthenticateEventArgs e)
in C:\WebSites\MedInfo\Login.aspx.vb:line 29
at
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e)
at System.Web.UI.WebControls.Login.AttemptLogin()
at System.Web.UI.WebControls.Login.OnBubbleEvent(Object source,
EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


Whats wrong
 
J

john smith

Vaidas said:
I has web project on virtual pc, maked with framework 2.0. there I was used
the method role.roleexists("admin") and everything was worked good.
but when i replace this project on my local machine, where is installed both
versions 1.1 and 2.0 of framework. And on the this method I am getting the
error
System.Web.HttpException was unhandled by user code
ErrorCode=-2147467259
Message="Unable to connect to SQL Server database."
Source="System.Web"
StackTrace:
at System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String
fullFileName, String dataDir, String connectionString)
at
System.Web.DataAccess.SqlConnectionHelper.EnsureSqlExpressDBFile(String
connectionString)
at System.Web.DataAccess.SqlConnectionHelper.GetConnection(String
connectionString, Boolean revertImpersonation)
at System.Web.Security.SqlRoleProvider.RoleExists(String roleName)
at System.Web.Security.Roles.RoleExists(String roleName)
at Login.Login1_Authenticate(Object sender, AuthenticateEventArgs e)
in C:\WebSites\MedInfo\Login.aspx.vb:line 29
at
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e)
at System.Web.UI.WebControls.Login.AttemptLogin()
at System.Web.UI.WebControls.Login.OnBubbleEvent(Object source,
EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


Whats wrong
The error message is quite descriptive really: "Unable to connect to SQL
Server database".

Make sure it's up and running fine, that you have a valid connection
string, and that ASP.Net is configured properly (i.e. machine.config and
all)
 
V

Vaidas Gudas

it is using sql server 2000 and it is working.
code fragment:
Dim sqlConn As New
SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("MedInfoConnectionString").ToString)

Dim sqlCmd As SqlCommand

Dim sqlDR As SqlDataReader

sqlConn.Open()

sqlCmd = sqlConn.CreateCommand

sqlCmd.CommandText = "SELECT dbo.PERSONALAS.PAVARDE, dbo.PERSONALAS.VARDAS,
dbo.Grupes.Pavadinimas, dbo.PERSONALAS.VARTOTOJAS,
dbo.PERSONALAS.SLAPTAZODIS,dbo.PERSONALAS.K_SKYRIUS " & _

"FROM dbo.Grupes INNER JOIN dbo.PERSONALAS ON dbo.Grupes.K_Grupe =
dbo.PERSONALAS.GRUPE where vartotojas='" & Me.Login1.UserName & "' and
slaptazodis='" & Me.Login1.Password & "'"

sqlDR = sqlCmd.ExecuteReader

If Not sqlDR.HasRows Then

Login1.FailureAction = LoginFailureAction.Refresh

Else

sqlDR.Read()

Session("skyrius_id") = sqlDR("K_SKYRIUS")

If Not Roles.RoleExists(sqlDR("Pavadinimas").ToString) Then

......



on the Roles.RoleExists(sqlDR("Pavadinimas").ToString I am getting the error
 
J

john smith

Vaidas said:
it is using sql server 2000 and it is working.

The problem isn't with your code or the connection string you're using
there. It's with the Role Provider - by default it's set to
LocalSqlServer - which is configured (default) to a local SQL Express
instance (file aspnetdb.mdf). If you're using SQL Server 2000 instead
you have to config this for things to work (same for other providers).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top