Showing posts with label asp. Show all posts
Showing posts with label asp. Show all posts

Sunday, March 11, 2012

Caching with Dynamic Security

I defined one role in my AS database with dynamic security for each dimension. I am accessing the AS database in an ASP.NET web application which runs under a domain user and uses Form Authentication. Therefore I always connect to the AS database under the same domain user even though security should be based on the user logged into the web application. When I run a MDX query, I pass along the web user's security info as part of the connectionstring and uses dynamic security to get the AllowedSet for each dimension. However, I notice my user defined function is ran only on the first time I run a query, meaning the dimension security is cached based on the domain user in the connection string and not the web user. Sorry if this sounds confusing but I can clarify a bit more if needed. My question boils down to: Is there a way to tell AS database to cache result base on the CustomData property of the connectionstring?

The answer is YES - AS is smart enough to recognize that different values of CustomData were used even though the real identity on the connection is the same. Since the main purpose of CustomData was for custom authentication - it is treated the same as different users. Same is true w.r.t. Roles and UserId properties.

HTH,

Mosha (http://www.mosha.com/msolap)

|||

Mosha,

As always, you are right and thanks for the help. I did a little more testing after my post and realized AS is caching the result base on the CustomData property. Thanks!

Wednesday, March 7, 2012

Cache problem in Report Services

Hi All,
We are using RS for our application to show report. We are calling URL
for all report from ASP with some parameters, like on click of a button
with some filters we are using report link as
http://localhost/reportserver?/rptParameter/rdlTestParameter&rs:Command=Render&rc:Parameters=false&CID=2067
When we click on button, report gets fired, but it shows old data and
when we press refresh button of RS it shows updated data. We changed
the data and fired the above url again, it doesnt show updated data and
when we press refresh button it will shows updated data. May be this is
due to cache but in Report Manager i have checked the Do not cache
reports.., but problem still persist, can anybody please tell me how to
solve this problem.
Thanks
Regards
RajeshHi,
when calling your report, you can add the following parameter:
http://localhost/reportserver?/rptParameter/rdlTestParameter&rs:Command=Render&rc:Parameters=false&rs:ClearSession=true&CID=2067
Laurent
"Raj" <kapse_rajesh@.rediffmail.com> a écrit dans le message de news:
1141463990.435176.137140@.i40g2000cwc.googlegroups.com...
> Hi All,
> We are using RS for our application to show report. We are calling URL
> for all report from ASP with some parameters, like on click of a button
> with some filters we are using report link as
> http://localhost/reportserver?/rptParameter/rdlTestParameter&rs:Command=Render&rc:Parameters=false&CID=2067
> When we click on button, report gets fired, but it shows old data and
> when we press refresh button of RS it shows updated data. We changed
> the data and fired the above url again, it doesnt show updated data and
> when we press refresh button it will shows updated data. May be this is
> due to cache but in Report Manager i have checked the Do not cache
> reports.., but problem still persist, can anybody please tell me how to
> solve this problem.
>
> Thanks
> Regards
> Rajesh
>|||Thanks Laurent, this solved my problem.
Thanks
Rajesh

Cache Problem - URGENT HELP !

Dear All,
I have web application (ASP.NET) where I use SQL Server Std Server
engine as backened.
The issue that I have noticed whenever I ran "perfmon" the Total Pages
and Cache Pages alway showss 100 which is topmost.
My WEB application execute many SP that return data to client. In most
of SPs I create Temp Table and drop the same upon completion of SP.
Also I get an alert from SQL Performance monitor tool which is shown
below:
" Not enough physical memory has been left for NT; this will cause
excessive NT paging, resulting in poor performance."
My SQL Server RAM 1 GB. Have configured SQL Server to "to dynamically
confgiure SQL memory"
Do you know what could be the problem of hitting "Total Pages" and
"Cache Pages" 100.
Kindly help and advise..
Many thanks in advance
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!If you only have 1 GB of RAM on the server, and the memory is maxed out, I
would check the counters in Performance Monitor to see if it indicated a
need for more RAM in the box... Are you running IIS and SQL Server on the
same box? Try setting your SQL Server to use a fixed amount of RAM (maybe
800 MB depending on what else you have running on that box?)
"Ahmed Jewahar" <ahmed.jewahar@.dhl.com> wrote in message
news:%23q3Gl6tMFHA.3328@.TK2MSFTNGP14.phx.gbl...
> Dear All,
> I have web application (ASP.NET) where I use SQL Server Std Server
> engine as backened.
> The issue that I have noticed whenever I ran "perfmon" the Total Pages
> and Cache Pages alway showss 100 which is topmost.
> My WEB application execute many SP that return data to client. In most
> of SPs I create Temp Table and drop the same upon completion of SP.
> Also I get an alert from SQL Performance monitor tool which is shown
> below:
> " Not enough physical memory has been left for NT; this will cause
> excessive NT paging, resulting in poor performance."
> My SQL Server RAM 1 GB. Have configured SQL Server to "to dynamically
> confgiure SQL memory"
> Do you know what could be the problem of hitting "Total Pages" and
> "Cache Pages" 100.
> Kindly help and advise..
> Many thanks in advance
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!|||Michael,
Thanks for reply.
Yes, I have IIS and SQL on same box. I tried below statment to check
memory used which is return 753 MB used.
Also I checked following counters on "Performance" monitor this AM which
return as follows:
Object: SQL Server: Memory Manager:
--
Counter: Total Server Memory (KB) shows between 75-80
Object: Memory
--
Counter: Cache Bytes shows 100
Object: SQL Server: Cache Manager:
--
Counter: Cache Pages Shows between 50-55
Counter: Cache Object Counts 100
Object: ASP.NET Application
--
Counter: Cache Total hits shows 100
Due to all above, I suspect that my application might have affected it's
performance. I mean, in terms of speed.
How can I resolved this problem ?. Shall I increase the RAM ? What about
the Cache counters ? The pages in the cache, would it increase the
performance or decrease the performance ?
What about if I apply following DBCC commands ?. Will it help ?
DBCC FREEPROCCACHE
DBCC DROPCLEANBUFFERS
I would really appreciate your tips or advise to increase the
performance of the application.
Many thanks in advance...
Regards,
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!|||My first thoughts would be - if at all possible, get IIS on it's own box.
If not possible, I would set SQL Server to have a Fixed Memory size.
Offhand I would say that your memory might be a bottleneck - to find out for
sure, you might want to check other counters. Here's a page that lists some
other counters you might want to check to verify that it is a memory
problem:
[url]http://www.sql-server-performance.com/performance_monitor_counters_memory.asp.[/ur
l]
If you determine it is a memory problem, your best bet might be to add some
memory to the box...
"Ahmed Jewahar" <ahmed.jewahar@.dhl.com> wrote in message
news:OBd7ZE2MFHA.3328@.TK2MSFTNGP14.phx.gbl...
> Michael,
> Thanks for reply.
> Yes, I have IIS and SQL on same box. I tried below statment to check
> memory used which is return 753 MB used.
>
> Also I checked following counters on "Performance" monitor this AM which
> return as follows:
> Object: SQL Server: Memory Manager:
> --
> Counter: Total Server Memory (KB) shows between 75-80
> Object: Memory
> --
> Counter: Cache Bytes shows 100
> Object: SQL Server: Cache Manager:
> --
> Counter: Cache Pages Shows between 50-55
> Counter: Cache Object Counts 100
> Object: ASP.NET Application
> --
> Counter: Cache Total hits shows 100
> Due to all above, I suspect that my application might have affected it's
> performance. I mean, in terms of speed.
> How can I resolved this problem ?. Shall I increase the RAM ? What about
> the Cache counters ? The pages in the cache, would it increase the
> performance or decrease the performance ?
> What about if I apply following DBCC commands ?. Will it help ?
> DBCC FREEPROCCACHE
> DBCC DROPCLEANBUFFERS
> I would really appreciate your tips or advise to increase the
> performance of the application.
> Many thanks in advance...
> Regards,
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!

Cache Dependency Problem

Hello.

I am having problems with SQL Cache dependency. I am using SQL 2005, ASP .net 2.0.

Every time i try to load data from cache, this is null. It acts like someone is constantly changing everything in the db.

Because of this my website makes hundreds of connections to the db instead of 5. This is a major issue that i cannot figure it out. PLEASE ADVISE.

On my local machine everything seems to work just fine. On the testing server the cache is always null.

Is cache dependency related

- to the platform used?

- to the number of IIS servers connected to the DB?

- to the sql user used?

Also a strange thing happens. When i change something in web.config the cache is working for about 1 min and after that it stops.

Here is the code i wrote:

public ManufacturerList GetAllManufacturers()
{
if (HttpContext.Current.Cache[ConstantsManager.Instance.GetDefaultAsString("CACHE_MANUFACTURERS")] != null)
return HttpContext.Current.Cache[ConstantsManager.Instance.GetDefaultAsString("CACHE_MANUFACTURERS")] as ManufacturerList;

SqlCacheDependency dep = new SqlCacheDependency(ConstantsManager.Instance.GetDefaultAsString("DB_NAME"), ConstantsManager.Instance.GetDefaultAsString("TABLE_MANUFACTURERS"));

_manufacturerList = new ManufacturerList();

DataReader reader = SqlHelper.ExecuteDataReader(WebContext.ConnectionString, CommandType.StoredProcedure, "dvx_web_MANUFACTURER_LoadAll", null);

while (reader.Read())
{
int manufacturerID = reader.GetInt("ID");

Manufacturer findManufacturer = _manufacturerList.FindByID(manufacturerID);

if (findManufacturer == null)
{
findManufacturer = new Manufacturer();
findManufacturer.LoadFromDataReader(reader);
_manufacturerList.Add(findManufacturer);
}
}

reader.Close();

HttpContext.Current.Cache.Insert(ConstantsManager.Instance.GetDefaultAsString("CACHE_MANUFACTURERS"), _manufacturerList, dep);

return _manufacturerList;
}

Thanks a lot.

Hi,

Look at this article describing some ways of using SQL Dependency Cache.

http://www.ondotnet.com/pub/a/dotnet/2005/01/17/sqlcachedependency.html

Friday, February 24, 2012

C#/SQL noob question

Using C# and ASP.NET, I need to connect to an SQL Server running Reporting Services, grab a report, supply a couple of parameters and an output format, and render a stream that I can write to a browser. Can anybody point me to an example or tutorial explaining how to do that?

thanks!

You probably want to start here:

http://msdn.microsoft.com/sql/bi/reporting/default.aspx?pull=/library/en-us/dnsql90/html/integratrsapp.asp

Sunday, February 19, 2012

C

Hi,

I have a bit of code written in class ASP that connects to a database with Command.Execute. It works fine with SQL 2000 but after an upgrade to SQL 2005 causes the asp page to hang while w3wp runs at at 100%

I'm running SQL 2005 SP1 on the same machine as IIS. I can't see anything in the event log or the SQL logs that would explain this (no errors in either). SQL profiler shows the stored procedure is called.

The code is below. Does anyone know of anything that might be causing this. I've spent two days so far trying to find a cause. The ODBC connection SDB1 is using SQL Native Client.

MyConn.Open "DSN=SDB1;Initial Catalog=database","username","password"

Set MyCommand.ActiveConnection=MyConn
MyCommand.CommandType = adCmdStoredProc
MyCommand.CommandText = "[owner].[procname]"
Set MyParam=MyCommand.CreateParameter("in_ip",adVarChar,adParamInput,10)
MyCommand.Parameters.Append MyParam
Set MyResult=MyCommand.CreateParameter("ip_country",adVarChar,adParamOutput,50)
MyCommand.Parameters.Append MyResult

MyCommand.Execute

Can anyone shed any light on this?

For anybody elses reference, I have found the cause of this.

The database user had connect permission but nothing else. This meant the user could connect to the database but not select/update or delete. Giving it the necessary rights solved the problem.

However, why this was causing IIS to run at 100% is still a mystery.

Regards,

Mark.