Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Monday, March 26, 2012

performance when refer to session object or variable

hi ive got some session objects which im using in some long switch statements.

performance wise is it better to assign the session objects to string variables first then use the variables within my code.

or is it just as good to use the session objects themselves each time within my code using the Tostring() method?

which is better please?If you could enumerate the objects to an intrinsic type like byte or int or something you will see a performance increase after approxamately three calls to the session variables. This is approxamate you can bench it yourself to get more accurate but your initial suspision is correct. I don;t think using a string would perform as well.

Saturday, March 24, 2012

permission denied on object sp_sdidebug

Hi, whenever I attach the asp_net to a web site, checking 3 boxes aspnet,
t-SQL and scripting in the dialog box, run the web site, I get te following
error in spite of the fact I am logged as an administrator and the tyhe
connectionn string has trusted conn.:
SqlException: EXECUTE permission denied on object 'sp_sdidebug', database
'master', owner 'dbo'.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +742
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +195
Thanks for your helpHi,
are you using Windows authentication or SQL Server authentication for
conecting to the DB. Or may be grant execute rights to the user through whic
h
you are loggin into in SQL Server.
HTH.
Kaustav Neogy.
"SalamElias" wrote:

> Hi, whenever I attach the asp_net to a web site, checking 3 boxes aspnet,
> t-SQL and scripting in the dialog box, run the web site, I get te followin
g
> error in spite of the fact I am logged as an administrator and the tyhe
> connectionn string has trusted conn.:
> SqlException: EXECUTE permission denied on object 'sp_sdidebug', database
> 'master', owner 'dbo'.]
> System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
> cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +742
> System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +195
> Thanks for your help
Hi SalamElias,
I think Kaustav's suggestion on checking the SQL db's security setting is
resonable. From the error info you provided, your program failed when try
to call a store procedure in the sql db. As Kaustav has said, you should
grant the proper permissions to the account you used to connect the sql db.
IF using Sqlserver authentication, that's the account you specify in the
connectionstring, if windows authentication, that'll be your asp.net
applications process identity if you 're not using impersonate.
Please feel free to let me know if you have anything unclear or there is
anything else we haven't quite understand well. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

permission denied on object sp_sdidebug

Hi, whenever I attach the asp_net to a web site, checking 3 boxes aspnet,
t-SQL and scripting in the dialog box, run the web site, I get te following
error in spite of the fact I am logged as an administrator and the tyhe
connectionn string has trusted conn.:
SqlException: EXECUTE permission denied on object 'sp_sdidebug', database
'master', owner 'dbo'.]
System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +742
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +195

Thanks for your helpHi,

are you using Windows authentication or SQL Server authentication for
conecting to the DB. Or may be grant execute rights to the user through which
you are loggin into in SQL Server.

HTH.

Kaustav Neogy.

"SalamElias" wrote:

> Hi, whenever I attach the asp_net to a web site, checking 3 boxes aspnet,
> t-SQL and scripting in the dialog box, run the web site, I get te following
> error in spite of the fact I am logged as an administrator and the tyhe
> connectionn string has trusted conn.:
> SqlException: EXECUTE permission denied on object 'sp_sdidebug', database
> 'master', owner 'dbo'.]
> System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
> cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +742
> System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +195
> Thanks for your help
Hi SalamElias,

I think Kaustav's suggestion on checking the SQL db's security setting is
resonable. From the error info you provided, your program failed when try
to call a store procedure in the sql db. As Kaustav has said, you should
grant the proper permissions to the account you used to connect the sql db.
IF using Sqlserver authentication, that's the account you specify in the
connectionstring, if windows authentication, that'll be your asp.net
applications process identity if you 're not using impersonate.
Please feel free to let me know if you have anything unclear or there is
anything else we haven't quite understand well. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Wednesday, March 21, 2012

Perserving characters in Session object

Hi,

I am having a problem storing Irish text in a session object - Irish text
has some symbols ( for example) that are being lost when I retrieve the
text from the session.

Any ideas how I can deal with this - the characters are being displayed
correctly on the page itself if they come from the database or any other
source rather than the session object.

JoeAcutally after a bit of further investigation I discovered that by default
asp.net uses UTF-8 (unicode) for everything which would accommodate these
characters. What was happening in my case was that I was using the thycotic
remote scripting component to do some server updates and to send such
characters to the server requires that you urlencode them first as that
component seems to rely on a hidden frame in the page to call the remote
script.

"Joe Molloy" <molloy_joe@.hotmail.com> wrote in message
news:OcCcchFxFHA.2960@.tk2msftngp13.phx.gbl...
> Hi,
> I am having a problem storing Irish text in a session object - Irish text
> has some symbols ( for example) that are being lost when I retrieve the
> text from the session.
> Any ideas how I can deal with this - the characters are being displayed
> correctly on the page itself if they come from the database or any other
> source rather than the session object.
>
> Joe

Perserving characters in Session object

Hi,
I am having a problem storing Irish text in a session object - Irish text
has some symbols ( for example) that are being lost when I retrieve the
text from the session.
Any ideas how I can deal with this - the characters are being displayed
correctly on the page itself if they come from the database or any other
source rather than the session object.
JoeAcutally after a bit of further investigation I discovered that by default
asp.net uses UTF-8 (unicode) for everything which would accommodate these
characters. What was happening in my case was that I was using the thycotic
remote scripting component to do some server updates and to send such
characters to the server requires that you urlencode them first as that
component seems to rely on a hidden frame in the page to call the remote
script.
"Joe Molloy" <molloy_joe@.hotmail.com> wrote in message
news:OcCcchFxFHA.2960@.tk2msftngp13.phx.gbl...
> Hi,
> I am having a problem storing Irish text in a session object - Irish text
> has some symbols ( for example) that are being lost when I retrieve the
> text from the session.
> Any ideas how I can deal with this - the characters are being displayed
> correctly on the page itself if they come from the database or any other
> source rather than the session object.
>
> Joe
>

Friday, March 16, 2012

Persist object

Hello all,
I'm in need of some brainstormin help!
We have an object that we use in a number of places, both by User Controls
and Pages. This object is loaded everytime we need to use the piece of
functionality.
Example:
The user logs in and the object is loaded, the user then clicks a link to do
a task and again the object is loaded again.
What is the best way to persist the object? Session, cookie etc as it will
be used alot as the user uses the app.
Also, what are people thoughts about this, and it there any patterns that
may help?
Thanks all,
JonJon,
If it is an aspx or html page and is called with the same parameters or
without any parameters, it will be cached on the client side and will open
very fast. You will have to tell us more about the nature of the object to
hear other suggestions.
Eliyahu
"Jon" <Jon@.discussions.microsoft.com> wrote in message
news:7472A3B1-1802-4EB5-8E5D-BAC04F26185D@.microsoft.com...
> Hello all,
> I'm in need of some brainstormin help!
> We have an object that we use in a number of places, both by User Controls
> and Pages. This object is loaded everytime we need to use the piece of
> functionality.
> Example:
> The user logs in and the object is loaded, the user then clicks a link to
do
> a task and again the object is loaded again.
> What is the best way to persist the object? Session, cookie etc as it will
> be used alot as the user uses the app.
> Also, what are people thoughts about this, and it there any patterns that
> may help?
> Thanks all,
> Jon
Some ramblings,
if the object is loaded from server side state then I suggest making
all your pages (and controls?) extend from a base class (that you
create), this class would extend from System.web.UI.Page,
This class could load the object and set a property, which the derived
classes could access.
If the object is not to big then I'd recomend doing this each page
load, caching the object brings in added complexity,
If its a big object (or static for all users) then cache it, use the
session for user based objects and cache for static objects
In my experience though its best to load the object with each page
request
Eliyahu,
The object is data that is a collection class that we loop through to
create a tree (like Windows). This tree is not only used for navigation, but
also used in UserControls to help the user when carrying out some action,
like copying a file, specifying where to place a file etc.
The data help in the collection class rarely changes, but when we use it, we
always reload it and we were just thinking if that would be a performance
drag?
Thanks,
Jon
"Eliyahu Goldin" wrote:

> Jon,
> If it is an aspx or html page and is called with the same parameters or
> without any parameters, it will be cached on the client side and will open
> very fast. You will have to tell us more about the nature of the object to
> hear other suggestions.
> Eliyahu
> "Jon" <Jon@.discussions.microsoft.com> wrote in message
> news:7472A3B1-1802-4EB5-8E5D-BAC04F26185D@.microsoft.com...
> do
>
>
Jon,
If the collection is specific to a user session, the best place is the
session.
If it is application-wide, meaning it is the same for all users, a public
static variable will be good. You can also use application's Cache if you
want to be able to control the way how the object persists.
Eliyahu
"Jon" <Jon@.discussions.microsoft.com> wrote in message
news:1BE9F76D-8B0A-4A21-B65A-54057D8E4BE7@.microsoft.com...
> Eliyahu,
> The object is data that is a collection class that we loop through to
> create a tree (like Windows). This tree is not only used for navigation,
but
> also used in UserControls to help the user when carrying out some action,
> like copying a file, specifying where to place a file etc.
> The data help in the collection class rarely changes, but when we use it,
we
> always reload it and we were just thinking if that would be a performance
> drag?
> Thanks,
> Jon
> "Eliyahu Goldin" wrote:
>
open
to
Controls
to
will
that

Persist object

Hello all,

I'm in need of some brainstormin help!

We have an object that we use in a number of places, both by User Controls
and Pages. This object is loaded everytime we need to use the piece of
functionality.

Example:

The user logs in and the object is loaded, the user then clicks a link to do
a task and again the object is loaded again.

What is the best way to persist the object? Session, cookie etc as it will
be used alot as the user uses the app.

Also, what are people thoughts about this, and it there any patterns that
may help?

Thanks all,

JonJon,

If it is an aspx or html page and is called with the same parameters or
without any parameters, it will be cached on the client side and will open
very fast. You will have to tell us more about the nature of the object to
hear other suggestions.

Eliyahu

"Jon" <Jon@.discussions.microsoft.com> wrote in message
news:7472A3B1-1802-4EB5-8E5D-BAC04F26185D@.microsoft.com...
> Hello all,
> I'm in need of some brainstormin help!
> We have an object that we use in a number of places, both by User Controls
> and Pages. This object is loaded everytime we need to use the piece of
> functionality.
> Example:
> The user logs in and the object is loaded, the user then clicks a link to
do
> a task and again the object is loaded again.
> What is the best way to persist the object? Session, cookie etc as it will
> be used alot as the user uses the app.
> Also, what are people thoughts about this, and it there any patterns that
> may help?
> Thanks all,
> Jon
Some ramblings,

if the object is loaded from server side state then I suggest making
all your pages (and controls?) extend from a base class (that you
create), this class would extend from System.web.UI.Page,

This class could load the object and set a property, which the derived
classes could access.

If the object is not to big then I'd recomend doing this each page
load, caching the object brings in added complexity,

If its a big object (or static for all users) then cache it, use the
session for user based objects and cache for static objects

In my experience though its best to load the object with each page
request
Eliyahu,

The object is data that is a collection class that we loop through to
create a tree (like Windows). This tree is not only used for navigation, but
also used in UserControls to help the user when carrying out some action,
like copying a file, specifying where to place a file etc.

The data help in the collection class rarely changes, but when we use it, we
always reload it and we were just thinking if that would be a performance
drag?

Thanks,

Jon

"Eliyahu Goldin" wrote:

> Jon,
> If it is an aspx or html page and is called with the same parameters or
> without any parameters, it will be cached on the client side and will open
> very fast. You will have to tell us more about the nature of the object to
> hear other suggestions.
> Eliyahu
> "Jon" <Jon@.discussions.microsoft.com> wrote in message
> news:7472A3B1-1802-4EB5-8E5D-BAC04F26185D@.microsoft.com...
> > Hello all,
> > I'm in need of some brainstormin help!
> > We have an object that we use in a number of places, both by User Controls
> > and Pages. This object is loaded everytime we need to use the piece of
> > functionality.
> > Example:
> > The user logs in and the object is loaded, the user then clicks a link to
> do
> > a task and again the object is loaded again.
> > What is the best way to persist the object? Session, cookie etc as it will
> > be used alot as the user uses the app.
> > Also, what are people thoughts about this, and it there any patterns that
> > may help?
> > Thanks all,
> > Jon
>
Jon,

If the collection is specific to a user session, the best place is the
session.

If it is application-wide, meaning it is the same for all users, a public
static variable will be good. You can also use application's Cache if you
want to be able to control the way how the object persists.

Eliyahu

"Jon" <Jon@.discussions.microsoft.com> wrote in message
news:1BE9F76D-8B0A-4A21-B65A-54057D8E4BE7@.microsoft.com...
> Eliyahu,
> The object is data that is a collection class that we loop through to
> create a tree (like Windows). This tree is not only used for navigation,
but
> also used in UserControls to help the user when carrying out some action,
> like copying a file, specifying where to place a file etc.
> The data help in the collection class rarely changes, but when we use it,
we
> always reload it and we were just thinking if that would be a performance
> drag?
> Thanks,
> Jon
> "Eliyahu Goldin" wrote:
> > Jon,
> > If it is an aspx or html page and is called with the same parameters or
> > without any parameters, it will be cached on the client side and will
open
> > very fast. You will have to tell us more about the nature of the object
to
> > hear other suggestions.
> > Eliyahu
> > "Jon" <Jon@.discussions.microsoft.com> wrote in message
> > news:7472A3B1-1802-4EB5-8E5D-BAC04F26185D@.microsoft.com...
> > > Hello all,
> > > > I'm in need of some brainstormin help!
> > > > We have an object that we use in a number of places, both by User
Controls
> > > and Pages. This object is loaded everytime we need to use the piece of
> > > functionality.
> > > > Example:
> > > > The user logs in and the object is loaded, the user then clicks a link
to
> > do
> > > a task and again the object is loaded again.
> > > > What is the best way to persist the object? Session, cookie etc as it
will
> > > be used alot as the user uses the app.
> > > > Also, what are people thoughts about this, and it there any patterns
that
> > > may help?
> > > > Thanks all,
> > > > Jon