C# - Performance Tips Try/catch Blocks?
Sep 7, 2010
In ASP.NET I would like your opinion regarding what is the best way for Handling Exceptions Would you to use try/catch blocks? Better to use try/catch blocks on every single piece of code/component? Or in wich situations?
View 5 Replies
Similar Messages:
Jan 20, 2011
regarding the performance improvement in Asp.Net?The best practise tips for asp.net performance improvement?
View 4 Replies
Mar 14, 2011
Let me know asp.net application performance tips..
View 2 Replies
Jun 16, 2010
List me guidelines which we have to follow while developing an asp.net application with improved performance:
-Using Pooling properly, Stored procedures, when to use AJAX update panel etc etc
View 1 Replies
Aug 13, 2010
Possible Duplicate:
Performance Cost Of ‘try’
I am being told that adding a try catch block adds major performance cost in the order of 1000 times slower than without, in the example of a for loop of a million. Is this true?
Isn't it best to use try catch block as much as possible?
View 7 Replies
Feb 7, 2010
Here is the code copied from [URL] In asp.net code behind, I use try-catch try to catch any error but never catch it. In SQL database, if I rename Employees to Employeesx or change column DepartmentID to DepartmentIDx, record will not be deleted (it is right) without any error (it is wrong, suppose catch an error).
CREATE PROCEDURE DeleteDepartment
(
@DepartmentID int
)
AS
BEGIN TRANSACTION
DELETE FROM Employees
WHERE DepartmentID = @DepartmentID
IF @@ERROR <> 0
BEGIN
ROLLBACK
RAISERROR ('Error', 16, 1)
RETURN
END
DELETE FROM Departments
WHERE DepartmentID = @DepartmentID
IF @@ERROR <> 0
BEGIN
ROLLBACK
RAISERROR ('Error', 16, 1)
RETURN
END
OMMIT
View 2 Replies
Sep 14, 2011
I get this error in the browser:
Code:
Thread was being aborted.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Threading.ThreadAbortException: Thread was being aborted.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ThreadAbortException: Thread was being aborted.]
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +486
System.Web.ApplicationStepManager.ResumeSteps(Exception error) +501
System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +123
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +379
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
I have try{}catch(Exception ex){} in the right place:
Code:
protected void Button1_Click(object sender, EventArgs e)
{
try
{
// all processing occurs inside here
}
catch(Exception ex)
{
}
}
I even created a global.asax file and on the Application_Error event, I wrote a code that would email me the error (and i'm not getting an email regarding that error when I get the error shown above). I know for a fact that the thread is going inside the "try" statement because I send emails to myself whenever it finishes certain codes inside of it. So how come I'm getting that error in my browser instead of it being handled in my "catch" statement? I have two problems here, one, why is the exception not going to my "catch" statement, and two, why am I getting that error in the first place.
Note: my web app calls a webservice.
View 2 Replies
Sep 20, 2010
I have developed a website in asp.net framework 2 . This website is being hosted in two different servers without any change in code. My issue is about the performance of these 2 sites. One website is taking much time for inserting datas to the DB (SQL server 2005). 2 websites are having different DB server.
I think the issue is for the DB server. How can we rectify the DB performance while insertion and Is there any other cause for this permance issue?
View 1 Replies
Apr 29, 2010
I am not sure if this is the right forum. I can not find a forum for LINQ.
I am working on an application using LINQ. Application performance is not up to par and my tests show that it is LINQ queries that are slow. I was wondering if anybody can recommend where I can find an article about optimizing LINQ performance maybe by compilation or other methods.
View 1 Replies
Apr 4, 2011
What should developers moving from ASP.NET Webforms watch out for when they move to ASP.NET MVC?
View 11 Replies
Mar 20, 2011
I am creating a service oriented application where trying to have everything using services....however there is something I am not sure of , I am having a page that calls the database at the page load...so what would be better and faster?? to call database in pageload , or to call wcf service from javascript during javascript load ??btw , I am using a repeater in the page , but I have created somekind of an engine to create the suitable html so...I'll be creating the repeaters html using the wcf and resend it back to the page If I am using a wcf service at the start.
View 1 Replies
Feb 16, 2010
Web Page Design is a very important stage while developing an asp.net project as it will create the look and feel of the site. So I want to be careful in this stage. Could you give me some practical tips for designing professional looking website? Or Is there any website that offers free Master Page design templates? I am going to develop a new web application for my company. So I want to provide a good looking, easy to navigate and consistent web application to them. Thanks in advance to all who reply.
View 2 Replies
Apr 21, 2010
Just another day i found myself writing code to show data on the UI. I am again using DataGrid/GridView (ASP.NET), User Id as link button (clickable) to redirect user to another page. User having hard time to find where to click(Though the link has underline and hand pointer as usual on hover) just another common table like structure Following are the columns for example, User ID (Link button), User Name, First Name, Last Name, Date Of Birth Now i would like to make it better form the usability point of view. Can someone suggest a good link, example or suggestions to make it better.
View 1 Replies
Nov 25, 2010
What are the best practices for making a hosted cms? I'm trying to make one with url rewritting.. Currently I can access the different sites with a foldername after the domainname, but I would like to hook up another domainname "subsite.com" to mainsite.com/subsiteI have tried talking to my webhost, but they couldn't help me with it, when the subfolders dont actually exist (the url are rewritten to the sitecore)
View 2 Replies
May 19, 2010
how to add a line break inside a tool tip.
I've got the following text: 'Orders made by this person: 78 Country of delivery: USA'
And I would like it to look like this: 'Orders made by this person: 78
Country of delivery: USA'
How can I do this?
ps. I'm using C# and Visual Studio
View 4 Replies
Jul 9, 2010
we have an app built in Java and they use a button onclick of it will re-direct to IIS (to our screen)...what kind of authentication should I need to make sure whether user is coming from that Java screen...
View 1 Replies
May 30, 2013
I am using VS 2010 login form and aspnet table for user creation and role assignment. Every thing is working excellent.
My concern is that more 200 users will logon on this site simultaneously what will be the effect on performance? how to optimize site speed when more than 200 users will be log on.
View 1 Replies
Jan 5, 2011
I've been trying to get into TDD but am hitting some stumbling blocks. I suppose a simplified example would be the best way to explain. My first assumption is that I start from the top. I want a web page that displays a list of categories say. So I write a test for a CategoryController whose Index action should return this list:-
Code:
[code]....
Bingo our test will pass. Now my problem here is how does TDD drive us beyond this point? Our tests have passed and it fulfills out requirements but of course we know that a fully working app would need say an ICategoryService to be passed into the Controller and the controller would use this to retrieve the categories.
View 10 Replies
Oct 31, 2010
I want to create a usercontrol that behaves like the Label usercontrol or the HyperLink usercontrol.
What I mean - the Label usercontrol has the Text attribute, and the text can also be set with the following way:
<asp:Label runat="server" id="lblTest">Text Here</asp:Label>
If I wish to create a usercontrol that can set the text between blocks to the actual Text attribute of the control.
Do I need to use Templated UserControl? If no - what is the correct way?
View 1 Replies
Sep 28, 2010
where we use <%@ %> <%= %> <%# %> etc.
what else asp tags can be added in asp.net web pages?
View 2 Replies
Feb 3, 2011
I am writing a dynamic control that I want to pass in something along the lines of the following:
HyperLink myLink = new HyperLink();
myLink.NavigateUrl = "/Home.aspx?id=<%= DataBinder.Eval("PageId") %>";
myLink.Text = "The link";
myControl.Controls.Add(myLink);
I want to be able to resolve the myLink.NavigateUrl at run-time according to the context that myControl puts the control into in the end (this is not a WebControl and therefore adding to the collection of controls doesn't output to page).
View 2 Replies
Mar 24, 2011
Is it possible to do something like this in regular ASP.NET (or something similar):
<ul>
<% foreach (var item in Model) { %>
<li id="<%: item.Id %>">
blah blah
</li>
<% } %>
</ul>
I need to do a gird, but I want to control how the html table is output.
View 3 Replies
Jan 22, 2011
I'm updating my old .aspx views with the new Razore view engine. I have a bunch of places where I have code like this:
<span class="vote-up<%= puzzle.UserVote == VoteType.Up ? "-selected" : "" %>">Vote Up</span>
Ideally I'd like to do this:
<span class="vote-up@{puzzle.UserVote == VoteType.Up ? "-selected" : ""}">Vote Up</span>
However there's two problems here:
vote-up@{puzzle.UserVote .... is not treating the @ symbol as a start of a code block @puzzle.UserVote == VoteType.Up looks at the first part @puzzle.UserVote as if it's supposed to render the value of the variable.
View 1 Replies
Dec 6, 2010
I have a big web application on asp.net 2.0.Usere open object editor there and makes some changes. They can not open the same object at one time.After they press "save" btn all changes process to save on server via postback.I am using transaction for save. There are a lot of procedures, checks and others to be done before saving operation is OK.
using (SqlConnection con = .........)
{
SqlTransaction trans = null;
try [code]...
For me this code is quite safe.
But periodicaly happens:one process from this web application on saving operation on mssql became "sleeping/awaiting" and others processes called by other users became locked by this process and organiza a queue.
One of them threw timeout excetion.....but others are waiting.So, my question is: does my code have some bad operation that allows command to became sleeping/awaiting?
View 3 Replies
Feb 10, 2010
I am doing a small human resource web application in my workplace and i have a CV section were employees can add their CVs to be displayed to the human resource manager.
I want to make something similar to what Stackoverflow Careers has done in the Experience and Education sections where the users can click the "add more experience" or "add more education" links for new form elements to appear and a remove, move up and/or move down links appear.
I think that this was possible using jQuery and either the append or appendTo functions. That's as much as I know about jQuery and have no idea on how to go about implementing that.
The solution that i require should:
Enable me to add a template one for the Experience section and the other for Education On the loading of the page at least one education section and one Experience section appears on the form Form controls must have an identifying value added to them to distinct them from other sections. For instance, when the page first appears each form control should end with 0, when the add more button is clicked, each form control's name should end with 1, and so on. Some sort of validaion
I am using ASP.NET WebForms if such information is needed.
View 1 Replies