.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

How to stop the repeated database queries for roles

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net
 

Hello, friends,

We have a web application using VS 2008, c#. We try to filter siteMap nodes based on security roles. We have our customized the mether GetRolesForUser() in RoleProvider class to determine a user's role. In this method, roles will be returned by querying an SQL Server database.

However, we found that each time a page was loaded/refershed, this  GetRolesForUser() was called, and the database would be queried. This is too MUCH and expensive.

We thought the roles should be queried only once when a user logs in. After that, role info should be stored somewhere for this user, rather than query DB all the time.

Any ideas, reference paper, snipet,...,?

Thanks a lot!




View Complete Post


More Related Resource Links

Top 100 sql queries running on all database

  
hi This is sql server 2008, I am trying to find the top 100 queries on all database that has the high CPU usage. Trying to find the database, CPU usage and queries. I have something here, but does not show the query part. SELECT   [sql_handle]   ,[statement_start_offset]   ,[statement_end_offset]   ,[plan_generation_num]   ,[plan_handle]   ,[creation_time]   ,[last_execution_time]   ,[execution_count]   ,[snapshot_execution_count]   ,[total_worker_time]   ,[snapshot_worker_time]   ,[min_worker_time]   ,[max_worker_time]   ,[total_physical_reads]   ,[snapshot_physical_reads]   ,[min_physical_reads]   ,[max_physical_reads]   ,[total_logical_writes]   ,[snapshot_logical_writes]   ,[min_logical_writes]   ,[max_logical_writes]   ,[total_logical_reads]   ,[snapshot_logical_reads]   ,[min_logical_reads]   ,[max_logical_reads]   ,[total_clr_time]   ,[snapshot_clr_time]   ,[min_clr_time]   ,[max_clr_time]   ,[total_elapsed_time]   ,[snapshot_elapsed_time]   ,[min_elapsed_time]   ,[max_elapsed_time]   ,[collection_time]   ,[snapshot_id]   FROM [Data Collection].[snapshots].[query_stats]    

SharePoint 3.0 stop logging after moving database

  
Hello! Our SP 3.0 logging and Usage Analysis Processing were used to working ok. After we moved database to another server for disk space reason, there is no new log file generated from the date of db moving. The logging settings and Usage Analysis setting are still the same. We tried disable / re-enable logging, it didn't help. From system log, I saw following errors, and then granted the service account all access to "IIS WAMREG admin Service" DCOM Config based on document found in MSDN. It still not help "The application-specific permission settings do not grant Local Activation permission for the COM Server application ..." Could someone please share info/knowledge on similar issue and solutions? I really appreciate it! Thank you in advance! John

Backup a database then stop it

  

Hi,

In my SQL Server 2000, I have a particular database that I would like to stop it immediately after I backup that database.  What I would like to do is to restore that backup file to a new SQL Server 2008 machine, so the application used to connect to the SQL Server 2000 db can connect to the SQL Server 2008 db.  The connection for the application connected to the SQL Server 2000 db is using the IP method(e.g., 192.168.X.X).
How do I do the backup then stop that database job in SQL Server 2000?
Thanks for help.

Jason


A little bug with WebMatrix Sql ce Database , WebSecurity and Roles ?

  

Hi , i'm reviewing heavily the api provided with webpages which is really cool , it reminds me the api zend provides for php.

But i add some issues with WebSecurity and the Roles object.

I think you should not be able to insert multiple times the same role to the same user with the Roles.AddUserToRole(user, role) command cause it makes the database editor bug big time. I could not edit the webpages_UsersInRoles table manually anymore because of identical rows in the Data editor. i had to do a SQL DELETE to be able to edit the table again. So maybe there should be some kind of check if the association exists before inserting another user/role relationship.

I wasn't able to use some methods of simpleroleprovider either. Is it fully implemented?

Anyway , i cant wait for the official stable release.

Regards


Backup a database then stop it

  

Hi,

In my SQL Server 2000, I have a particular database that I would like to stop it immediately after I backup that database.  What I would like to do is to restore that backup file to a new SQL Server 2008 machine, so the application used to connect to the SQL Server 2000 db can connect to the SQL Server 2008 db.  The connection for the application connected to the SQL Server 2000 db is using the IP method(e.g., 192.168.X.X).
How do I do the backup then stop that database job in SQL Server 2000?
Thanks for help.

Jason


assigning database roles with smo (C#)

  

Hi All,

I'm using VS C# express with SQL 2005 express.

I have the following problem:

I would like to assign database roles in a given database for a login by using smo. Let's say:

I have a Login, created with smo named MyLogin and a database name MyDatabase.

How can I map MyLogin to MyDatabase and give for example db_datawriter database role membership for it, using SMO?

I do not find the way, propably I miss something...

Any help is highly appreciated, I would be thanksfull if one could give a code example to solve this.

Regards,

Lacko

 


Replication and database roles

  

Hi all!

We have replication set up between 2 servers (SQL 2005) and among tables and views we also replicate procedures. Because roles can't get replicated, we have roles with procedure execute permissions set up on Subscriber server. It works fine until we add procedure at Distrubutor server and reinitialize the subscription. Then database roles get "reset" i.e. all procedure entries are removed. Table entries are left intact in DB role.

Can someone tell me if this is functioning as designed or is something misconfigured. If database role can't get replicated, then it would be nice if they could at least not be replicated.

I would appreciate any help or to be pointed in right direction.

Kind regards, Max


stop progress during database restore

  

HI,

After I stopped progress during database restore, I found database restoring...

How can I get the initial database back to work.

For example: two database A and B, when I resotre A from B I found it is incorrect, I stop the restore and want previous A still works. What should I do?

 


Sea Cloud

Multiple database support with Entity Framework

  
One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Export Visio Database Table Names to Excel

  
If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

MS SQL Server: Disconnect Users From Database - Kill User Session

  
If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

  
We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.

Adding Rows in GridView without using a Database

  
This article describes on how to add rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in the TextBox on Button Click and retain the GridView data on post back.

Adding Multiple Columns and Rows in GridView without using a Database

  
This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

ASP.NET Database Tutorial

  
This tutorial will show you how to display data using the .NET GridView Control, ASP.NET 2.0 and VB.NET

The GridView control is a powerful tool and is simple to implement.

First, you will need to import the System.Data.SqlClient namespace.

ASP.NET forms authentication with roles

  
.A timeout is specified in minutes. This is "time since last request" not the "time since login". If a login is indicated to be persistent (described later) this is ignored.
.A protection method is specified for the cookie.
Next I wanted to specify a folder to which access is restricted to people who have logged in. To do this I entered the following code in the web.config file (beneath

Connestion string create any database server

  
This links important to how to create connection string to any data base sever.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend