Showing posts with label access. Show all posts
Showing posts with label access. Show all posts

Monday, March 26, 2012

Performance with OO approach

At the moment, I use adhoc data access to load data. I am looking at moving away from this and using classes instead. Lets take an example - I am making a booking system for a doctor's surgery. At the moment, I would load the data for a single booking straight from the database. So I would create a SqlCommand, and use a stored procedure to retrieve the values I want.

I want to move this into a seperate class. This would make it a lot easier to manage. So I would have a class called clsBooking. Within this class I would have functions such as:

Struct Booking BookingID as integer PatientName as varchar'''' etc. etc.End StructFunction getBooking (BookingID) as BookingFunction getBookingForPatient (PatientID) as Booking()etc.etc.

What I want to know is how this will impact the performance of my website. I do not expect more that 5 concurrent users at one time, so I do not see a huge problem. I would still like to know what issues I may face though.

Thanks for any help

Jag

Hi,

for all my asp.net programs i have implemented a complete object oriented business layer. I have no problems with performance with this systems. But why you use a struct instead a class? I think you should implement a class like this:

class Booking
{
private int bookingID = 0;
... other variables...

public Booking(int id)
{
Create object and load data ...
}

public int BookingID
{
get
{
return bookingID;
}
}
... and so on ...
}

Regards
Marc André


I am new to this - so I will be learning as I go. So far I have used a struct because I was loading the information for the logged in user and saving this in the session. I did not want to load the user data every time the pages loaded, but I also needed something that was serialisable.

I also like it because the code looks cleaner (rather than having a lot of public variables, I have one struct I access and I know what information I can get for that booking).

This is a simplified example. I am actually designing this for a survey with tickboxes - and so I could anything above and beyond 50 fields I need to load into the class.

One problem I am not sure how to handle is a search datagrid. I have a filter with a lot of choices, and I build the sql query dynamically through code. I'm not sure how this fits into the OO approach.


Hi,

on MSDN exists a good Tutorial about OO and ASP.NET:http://msdn2.microsoft.com/en-us/library/bb332381.aspx

Regards
Marc André

Permission & Access problem.

Greetings everyone,

I want to grab some data from a local site hosted on sharepoint services. I tried using the HttpWebRequest & HttpWebResponse classes. Here is the exact code
-----------------------
string lcUrl = "http://xxxxx/";

HttpWebRequest loHttp = (HttpWebRequest) WebRequest.Create(lcUrl);
loHttp.Timeout = 10000;
loHttp.UserAgent = "Code Sample Web Client";
HttpWebResponse loWebResponse = (HttpWebResponse) loHttp.GetResponse();
-----------------------

The problem is I could not open the connection because maybe the site does not allow anonymous access. How do I provide my credentials and open the site and retrieve data.The Credentials property - use a System.Net.NetworkCredential instance containing the details for a user with administrative rights on SharePoint, and also set the PreAuthenticate property to "true"

Saturday, March 24, 2012

Permission denied

Me again :)

I'm trying to delete a file and getting this:

System.UnauthorizedAccessException: Access to the path "C:/inetpub/wwwroot/appdata/photos/" is denied.

I have identity impersonate="false" and the ASPNET account has full rights for the folder.
The app is running on a remote server.

Any ideas? I'm getting frustrated here.

Thanks,

DavidAre you sure the application pool that your app is running on is using the ASPNET user account to run? Make sure its not the IISWPG user (or any other user for that matter). If your remote box is running Windows 2003, I bet that is the issue..
Thanks Sharbel, if IIS_WPG is a problem, what is the correct configuration for the application pool identity? This is an intranet server on an internal network.

David
Well, it's not that it's 'incorrect', it's just that you might be giving the ASPNET user permission, but it's the IIS_WPG that needs it.

Permission to access PDF files from ASP.NET

Hi All,

My web app requires to access a PDF document. However it will not open when
I start to access it using Process.Start("fileName"). Although at the task
manager, it says that the Acrobat service has been started by ASPNET. Is
there something I did wrong or have not done? Pls help.

Thanksryu wrote:
> Hi All,
> My web app requires to access a PDF document. However it will not open when
> I start to access it using Process.Start("fileName"). Although at the task
> manager, it says that the Acrobat service has been started by ASPNET. Is
> there something I did wrong or have not done? Pls help.
> Thanks

You want to open a PDF on the *server*??

Process.Start will open only local (that is: local *to the server*)
processes and will open them on the *invisible* desktop of the ASPNET user.

If you want to open that PDF file on the *client*, you need to send
that file to the client:
Response.AppendHeader("Content-Disposition", "attachment;
filename=myfile.pdf");
Response.ContentType = "application/pdf";
Response.WriteFile("myLocalFile.pdf");
Response.End();

--
Hans Kesting

Permission to access PDF files from ASP.NET

Hi All,
My web app requires to access a PDF document. However it will not open when
I start to access it using Process.Start("fileName"). Although at the task
manager, it says that the Acrobat service has been started by ASPNET. Is
there something I did wrong or have not done? Pls help.
Thanksryu wrote:
> Hi All,
> My web app requires to access a PDF document. However it will not open whe
n
> I start to access it using Process.Start("fileName"). Although at the task
> manager, it says that the Acrobat service has been started by ASPNET. Is
> there something I did wrong or have not done? Pls help.
> Thanks
>
You want to open a PDF on the *server*'
Process.Start will open only local (that is: local *to the server*)
processes and will open them on the *invisible* desktop of the ASPNET user.
If you want to open that PDF file on the *client*, you need to send
that file to the client:
Response.AppendHeader("Content-Disposition", "attachment;
filename=myfile.pdf");
Response.ContentType = "application/pdf";
Response.WriteFile("myLocalFile.pdf");
Response.End();
Hans Kesting

Permissions Error When Accessing Access Database

When I attempt to access a Microsoft Access database from my website, I
recieve the following error:

Server Error in '/' Application.
------------------------

Security Exception
Description: The application attempted to perform an operation not allowed
by the security policy. To grant this application the required permission
please contact your system administrator or change the application's trust
level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the
permission of type 'System.Data.OleDb.OleDbPermission, System.Data,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Take note that the description says that this can be fixed by modifying the
configuration file, which I am assuming is referring to the Web.config file.
I have successfully run this application on my machine using Visual Studio
2005's Development Server with the settings currently in the Web.config
file, so if modifying the Web.config file will fix it, what do I need to
change? Thanks.
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/On Jun 29, 2:50 am, "Nathan Sokalski" <njsokal...@.hotmail.comwrote:

Quote:

Originally Posted by

When I attempt to access a Microsoft Access database from my website, I
recieve the following error:
>
Server Error in '/' Application.
-----------------------*--
>
Security Exception
Description: The application attempted to perform an operation not allowed
by the security policy. To grant this application the required permission
please contact your system administrator or change the application's trust
level in the configuration file.
>
Exception Details: System.Security.SecurityException: Request for the
permission of type 'System.Data.OleDb.OleDbPermission, System.Data,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
>
Take note that the description says that this can be fixed by modifying the
configuration file, which I am assuming is referring to the Web.config file.
I have successfully run this application on my machine using Visual Studio
2005's Development Server with the settings currently in the Web.config
file, so if modifying the Web.config file will fix it, what do I need to
change? Thanks.
--
Nathan Sokalski
njsokal...@.hotmail.comhttp://www.nathansokalski.com/


Why do you use OleDb for MS Access?

http://msdn2.microsoft.com/en-us/li...connection.aspx
An application that creates an instance of the OleDbConnection object
can require all direct and indirect callers to have sufficient
permission to the code by setting declarative or imperative security
demands. OleDbConnection makes security demands using the
OleDbPermission object. Users can verify that their code has
sufficient permissions by using the OleDbPermissionAttribute object.
Users and administrators can also use the Code Access Security Policy
Tool (Caspol.exe) to modify security policy at the computer, user, and
enterprise levels. For more information, see Code Access Security and
ADO.NET.

http://msdn2.microsoft.com/en-us/library/0x4t63kb.aspx
I use OleDb for MS Access because of the namespaces that are included in the
..NET Framework (or that I have ever heard of from third parties)
System.Data.OleDb is the one that is supposed to be used when accessing a MS
Access database. The reason I am using MS Access for this website rather
than a higher quality database such as SQL Server or Oracle is because the
organization the site is for cannot afford anything else.

I have used System.Data.OleDb for MS Access databases in other sites I have
written, such as my personal website, with no problem, and any books that I
have read that use MS Access as their example database have as well, so I
know that it is the right one to use.

I have never had to deal with any of the objects you mention (except for
OleDbConnection, of course). Could you please either give me a code sample
or direct me to a site that gives one? Thanks.
--
Nathan Sokalski
njsokalski@.hotmail.com
http://www.nathansokalski.com/
"Alexey Smirnov" <alexey.smirnov@.gmail.comwrote in message
news:1183101114.868636.153110@.c77g2000hse.googlegr oups.com...
On Jun 29, 2:50 am, "Nathan Sokalski" <njsokal...@.hotmail.comwrote:

Quote:

Originally Posted by

When I attempt to access a Microsoft Access database from my website, I
recieve the following error:
>
Server Error in '/' Application.
-----------------------*--
>
Security Exception
Description: The application attempted to perform an operation not allowed
by the security policy. To grant this application the required permission
please contact your system administrator or change the application's trust
level in the configuration file.
>
Exception Details: System.Security.SecurityException: Request for the
permission of type 'System.Data.OleDb.OleDbPermission, System.Data,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
>
Take note that the description says that this can be fixed by modifying
the
configuration file, which I am assuming is referring to the Web.config
file.
I have successfully run this application on my machine using Visual Studio
2005's Development Server with the settings currently in the Web.config
file, so if modifying the Web.config file will fix it, what do I need to
change? Thanks.
--
Nathan Sokalski
njsokal...@.hotmail.comhttp://www.nathansokalski.com/


Why do you use OleDb for MS Access?

http://msdn2.microsoft.com/en-us/li...connection.aspx
An application that creates an instance of the OleDbConnection object
can require all direct and indirect callers to have sufficient
permission to the code by setting declarative or imperative security
demands. OleDbConnection makes security demands using the
OleDbPermission object. Users can verify that their code has
sufficient permissions by using the OleDbPermissionAttribute object.
Users and administrators can also use the Code Access Security Policy
Tool (Caspol.exe) to modify security policy at the computer, user, and
enterprise levels. For more information, see Code Access Security and
ADO.NET.

http://msdn2.microsoft.com/en-us/library/0x4t63kb.aspx
"Alexey Smirnov" <alexey.smirnov@.gmail.comwrote in message
news:1183101114.868636.153110@.c77g2000hse.googlegr oups.com...

Quote:

Originally Posted by

Why do you use OleDb for MS Access?


How else would you expect to use a Jet database within the .NET
Framework...?

--
http://www.markrae.net

Wednesday, March 21, 2012

Permissions Error When Accessing Access Database

When I attempt to access a Microsoft Access database from my website, I
recieve the following error:
Server Error in '/' Application.
----
--
Security Exception
Description: The application attempted to perform an operation not allowed
by the security policy. To grant this application the required permission
please contact your system administrator or change the application's trust
level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the
permission of type 'System.Data.OleDb.OleDbPermission, System.Data,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Take note that the description says that this can be fixed by modifying the
configuration file, which I am assuming is referring to the Web.config file.
I have successfully run this application on my machine using Visual Studio
2005's Development Server with the settings currently in the Web.config
file, so if modifying the Web.config file will fix it, what do I need to
change? Thanks.
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/On Jun 29, 2:50 am, "Nathan Sokalski" <njsokal...@.hotmail.com> wrote:
> When I attempt to access a Microsoft Access database from my website, I
> recieve the following error:
> Server Error in '/' Application.
> ----=
--=AD--
> Security Exception
> Description: The application attempted to perform an operation not allowed
> by the security policy. To grant this application the required permission
> please contact your system administrator or change the application's trust
> level in the configuration file.
> Exception Details: System.Security.SecurityException: Request for the
> permission of type 'System.Data.OleDb.OleDbPermission, System.Data,
> Version=3D2.0.0.0, Culture=3Dneutral, PublicKeyToken=3Db77a5c561934e089' =
failed.
> Take note that the description says that this can be fixed by modifying t=
he
> configuration file, which I am assuming is referring to the Web.config fi=
le.
> I have successfully run this application on my machine using Visual Studio
> 2005's Development Server with the settings currently in the Web.config
> file, so if modifying the Web.config file will fix it, what do I need to
> change? Thanks.
> --
> Nathan Sokalski
> njsokal...@.hotmail.comhttp://www.nathansokalski.com/
Why do you use OleDb for MS Access?
http://msdn2.microsoft.com/en-us/li...edbconnection.=
aspx
An application that creates an instance of the OleDbConnection object
can require all direct and indirect callers to have sufficient
permission to the code by setting declarative or imperative security
demands. OleDbConnection makes security demands using the
OleDbPermission object. Users can verify that their code has
sufficient permissions by using the OleDbPermissionAttribute object.
Users and administrators can also use the Code Access Security Policy
Tool (Caspol.exe) to modify security policy at the computer, user, and
enterprise levels. For more information, see Code Access Security and
ADO.NET.
http://msdn2.microsoft.com/en-us/library/0x4t63kb.aspx
I use OleDb for MS Access because of the namespaces that are included in the
.NET Framework (or that I have ever heard of from third parties)
System.Data.OleDb is the one that is supposed to be used when accessing a MS
Access database. The reason I am using MS Access for this website rather
than a higher quality database such as SQL Server or Oracle is because the
organization the site is for cannot afford anything else.
I have used System.Data.OleDb for MS Access databases in other sites I have
written, such as my personal website, with no problem, and any books that I
have read that use MS Access as their example database have as well, so I
know that it is the right one to use.
I have never had to deal with any of the objects you mention (except for
OleDbConnection, of course). Could you please either give me a code sample
or direct me to a site that gives one? Thanks.
--
Nathan Sokalski
njsokalski@.hotmail.com
http://www.nathansokalski.com/
"Alexey Smirnov" <alexey.smirnov@.gmail.com> wrote in message
news:1183101114.868636.153110@.c77g2000hse.googlegroups.com...
On Jun 29, 2:50 am, "Nathan Sokalski" <njsokal...@.hotmail.com> wrote:
> When I attempt to access a Microsoft Access database from my website, I
> recieve the following error:
> Server Error in '/' Application.
> ----
-_--
> Security Exception
> Description: The application attempted to perform an operation not allowed
> by the security policy. To grant this application the required permission
> please contact your system administrator or change the application's trust
> level in the configuration file.
> Exception Details: System.Security.SecurityException: Request for the
> permission of type 'System.Data.OleDb.OleDbPermission, System.Data,
> Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
> Take note that the description says that this can be fixed by modifying
> the
> configuration file, which I am assuming is referring to the Web.config
> file.
> I have successfully run this application on my machine using Visual Studio
> 2005's Development Server with the settings currently in the Web.config
> file, so if modifying the Web.config file will fix it, what do I need to
> change? Thanks.
> --
> Nathan Sokalski
> njsokal...@.hotmail.comhttp://www.nathansokalski.com/
Why do you use OleDb for MS Access?
http://msdn2.microsoft.com/en-us/li...y/0x4t63kb.aspx
"Alexey Smirnov" <alexey.smirnov@.gmail.com> wrote in message
news:1183101114.868636.153110@.c77g2000hse.googlegroups.com...

> Why do you use OleDb for MS Access?
How else would you expect to use a Jet database within the .NET
Framework...?
http://www.markrae.net