calling stacks in asp.net - asp.net

I have a procedure in asp.net web site that gives strange result sometimes, I’m thinking to add some code to track it. My question is, in the production environment, is there any way that I can get the calling stacks like the one in the exceptions?
thanks.

You can use Environment.StackTrace.
http://msdn.microsoft.com/en-us/library/system.environment.stacktrace.aspx

Related

"cacheInternal" is not recognized after KB4024848 installation

I am taking over an ASP.NET MVC application from someone who left. The application was developed using .NET Framework4.
Everything was working fine, until an automatic security update was pushed to the system.
Basically, the following statement now throws a NULL exception after the push of KB4024848:
object obj = typeof(HttpRuntime).GetProperty("CacheInternal",BindingFlags.NonPublic|BindingFlags.Static).GetValue(null,null);
Looks like the key string "cacheInternal" is not recognized anymore.
Rollback of KB4024848 would make the statement work again.
Any idea about this issue, as well as what could be an alternative solution to get the same object value? (This statement is part of a section of code trying to get a list of active sessions, using InProcSessionState.)
Your solution to this question will be greatly appreciated, since we have been spending quite sometime to work on it.

SQL - Whole Records Being Cleared Out Through ASP.NET Web Forms Application

I'm part of a team building a large ASP.NET Web Forms application, and have recently gotten complaints that some records are being "cleared out" after being created -- in this case they create an "inventory" item, save it, and then perhaps after editing some of the data and re-saving, all of the fields are suddenly blank.
I realize that this could be some faulty logic on the save, in which case it will be difficult for you to offer insight, but we've never come across this particular issue before, and haven't really touched the logic. I'm wondering if anyone has some insight into what could possibly be going on, if it's possible that something sporadically happens on the client which makes the values of the input fields blank or unreadable...? I don't know, I'm a bit in the dark and frustrated because I can't reproduce the behavior, and we're losing a bunch of data.
Thanks in advance for any bit of direction or advice.
Related issues in WebForms are often caused by logic related to Page.IsPostBack and values being reset.
Without code it's hard to say; I'd suggest adding some temporary code to log the posted data (and function calls down the line to the database writes). Without logging you're blind.

System.Web.UI.Control.LoadRecursive() - Insufficient stack to continue executing the program safely.

I have an ASP.NET web application developed in C# and .Net v4. When you login in and leave for the page for some 15-20 minutes, I get the "Insufficient stack to continue executing the program safely."
According to my knowledge, there is no way you can try-catch the stackoverflow in .Net. I would imagine that recursive loading of web page and active session checking leading to this error (maybe a bad coding practice). I have also added the screenshot as i am able to figure it out from Stack trace. If anyone help me in this,it will be helpful.
I think I have found the solution. Still the test. Check this Link and this
they really looks promising. I will keep you guys updated when I succeed..
Thank you all for your help.
The problem is this callstack is right at the end of the stack.
A few things to look for:
Is there anywhere in your code where you are using .FindControl(string id)?
If so, is it locating a control and then trying to locate it further?
Are you dynamically creating controls, like for <asp:Placeholder/> controls.
It can be recursive when you reference the parent from within a nested control, which then gets re-referenced by the parent.

Creating a "Live" ASP.NET MVC Application

From either a high-level perspective, or a low level and very specific one, what is the best way to constantly poll a database for updates?
I would like to create a "live" application which, using ajax, displays the most current data. I have partial views which Ajax.ActionLink the correct data in, but only OnClick of that generated link.
Is using a trigger and some sort of application code the best way to do this? For example, a trigger on all tables, which sets some field as "changes have been made since last read"?
Or is it better to use a function to poll the database on an interval to check for changes (I for-see this possibly being taxing with all the constant chatter to the DB)?
Or is a combination of these 2 approaches best? Or is there something I am leaving out completely?
SignalR was designed to solve exactly this problem.

Filtering Data in ASP.NET Web Services

I've been using this site for quite a while, usually being able to sort out my questions by browsing through the questions and following tags. However, I've recently come across a question that is rather hard to lookup amongst the great number of questions asked - a question I hope some of you might be able to share your opinion on.
As my problem is a bit hard to fit into a single line, going in the title, I'll try to give a bit more details on the problem I've encountered. So, as the title says I need to filter, or limit, some of the response data my standard ASP.NET Soap-based Web service returns on invoking various web methods. The web service is used to return data used by other systems (a data repository more or less), where the client today is able to specify a few parameters on how the data should be filtered and in return a full-set of data back.
Well, easy enough I thought, just put additional filtering options on the existing web methods which needs a bit more filtered applied, make adjustments on the server-side and we are all set to go - well, unfortunately it turned out to be a bit more tricky then this.
The problem I am facing is that I'm working on a web service running in a production environment, which needs to be extended in such that additional filters can be applied to existing web method being invoked w/o affecting the calls already being made by other systems used by the customer using their client stubs. This is where I am a bit troubled, since I can't seem to find a "right solution" on extending the current web service.
Today, the filter is send as a custom data structure which holds information on which data should filtered, but I am not sure if I can simply just add more information to this data structure w/o breaking code at the clients? One of my co-workers suggested that I could implement a solution where I would extend the web.config on the server-side to hold a section with details on which data should be excluded (filtered out), but I don't find this to be a viable solution long-sighted - and I don't trust customers with such an option since this is likely to go wrong at some point. So the solution I am looking for is a way that I can apply a "second filter" to the data I am requesting from the client so instead of getting a full-set of data back it should only give a fraction, it implemented in such that the filter can be easily modified and it must not affect the current client calls.
Any suggestions on how I should approach this problem?
Thanks!
Kind regards,
E.
A pretty common practice is to create another instance of the application OR use part of the url to signify the version of the endpoint they are connecting to, perhaps the virtual directory is the date. That way old calls will go to the old API and new calls will come in on the new API.
http://api.example.com/dostuff
vs
http://api.example.com/6-7-2011/dostuff

Resources