Hi,
I have coded my business objects ( a list class, a single entity class and the info class , along with code for a web based front end and the structure to represent a DAL and a Library, to reflect the examples in the book Expert C# 2008 Business Objects. However, while everything compiles correctly, no data is returned to the grid i have created.
I am utilizing Windows Authentication, making sure that the web site disables anonymous access and enables Windows Authentication etc. I have set the appropriate changes in the web.config file.
I am suspecting that I am missing something small. Any ideas as to what might cause no data to show up? (there is data in the table in the database ;-) )
I have installed the project tracker application which points to the projecttracker database on the same sql server as my above application and it works, so I am pretty sure much of the database itself is properly configured on the server.
I can include my code in a subsequent reply to this post. Was just wondering if this was something really simple that I havent configured?
Thanks
From what I can see no.
I did look a little further into my code for the web page and noticed that I hadnt coded in the
OnSelectObject
="PriorityListDataSource_SelectObject" as part of the CSLA datasource. So it wasnt linking up with the code to go get the business objectI finally fixed that, but now it looks for the database and cannot find the database name, even though its in the app.config, web.config, and the Database.cs code in the DAL library.
In running a trace, it looks like it isnt authorizing me to do the select. It seems to skip that code and go directly to a deny authorization segment.
I am assuming then it must be something to do with the security classes.
In Lhotka's latest book he seeems to imply that if Windows authentication is used that PTPrincipal and PTSecurity arent needed. So I havent included any specialized code ( used for custom authentication) in my solution/projects. I just wanted to get data back initially without imposing any role restrictions. Can all parts of the security model be 'ignored' initially for authorization/authentication if one is intending to use Windows Integrated Security ? Or are their certain base parts of the security model that must be in place , even if windows autheincation is used?
web.config file has csla.authentication="Windows" and authenication mode =Windows and identity impersonate = true. IIS server has anonymous access disabled, windows authentication enabled and impersonation enabled.
Thanks
Is the database located on the same box as the web server?
If not, then you have run into the problem of 2 network hops which is difficult to do with Windows security. See p431 of the C# 2008 book. Rocky does not solve the problem for you in this case. You may have to Google this one.
Try the same solution using custom Principal code and it should work fine across 2 hops.
Joe
Hi Joe,
Thank you.
Yes it is on the same box as the web server. At this point I am trying only the simplest of configurations. ie everything on one machine, and no special security -Windows Authentication only. Whenever I try out new versions of the CSLA framework , my first goal is to just get data to appear on the grid using the new framework.
I now have it as far as hanging in the dataportal fetch area. The message coming back in the web application is
DataPortal.Fetch failed (Database name not found in config file (HRSMV20)) in the Dataportal.cs program.
Modelling after the project tracker application, I have the following code in my Database.cs file
using
System;using
System.Collections.Generic;using
System.Linq;using
System.Text;namespace
HRSMCSLA3.DAL{
public class Database{
public const string HRSMV20 = "HRSMV20";}
}
The linq to SQL dbml file name is HRSMV20
AND
my web.config file includes the following along with the app.config files
<
connectionStrings><
add name="HRSMCSLA3.DAL.Properties.Settings.HRSMV20ConnectionString" connectionString="Data Source=LYNDON-MAIN\VS2008;Initial Catalog=HRSMV20;Integrated Security=True" providerName="System.Data.SqlClient"/></
connectionStrings>CSLA Authenication is Windows
Authentication Mode is Windows
Impersonate =true
and
Anonymous access turned off, Windows Integrated Security is turned on (using IIS 7.0)
My mistake is probably something really simple- but these are the hardest to trackdown ;-) :(
Problem resolved.
Developer error :(
I had assumed the name in the connect string in the app.config file was supposed to be the same as the web.config.
It wasnt.
Lhotka's project tracker example had it correct. I didnt
My bad.
Thanks for everyones help
Copyright (c) Marimer LLC