Solved

How to code a try catch?

Posted on 2008-10-01
3
444 Views
Last Modified: 2012-06-27
I am new to programming. I am writing a web site for my fantasy football league using VS 2005 in C#. The website does not display correctly in firefox. IE works great. SO my thought was to use a try catch statement to check the web browser if IE continue on if any other browser then catch and reload website in IE. I am correct in my thinking. If so how would I go about coding this.
Thanks in advance for any help. DL
0
Comment
Question by:dxladner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 50 total points
ID: 22621189
the try/catch approach is not the right way. First, it is slow, when an exception is produced the program slowly processes the exception.
So, you just have to store the browser type in a session variable and put some IF statements to handle them properly.
0
 
LVL 15

Assisted Solution

by:angus_young_acdc
angus_young_acdc earned 50 total points
ID: 22622154
As stated a try catch may not be the best method, however I would put it in your backend code to handle any "gotchas"

To create a try catch its simply:

try
{
      // Your code would go here you wish to use.
}
catch(Exception ex)
{
      throw ex;
      // You would have your own exception handling here that would be far better
      // than a rather poor throw
}

Have the try be the first thing in your method.  You can also add a "finally{}" to the try catch.
0
 
LVL 26

Assisted Solution

by:Anurag Thakur
Anurag Thakur earned 25 total points
ID: 22628076
a website in ASP.NET always works fine with IE, but there are certian things which if corrected will make it work with all other browsers
I will recommend that you should not force the users to only view your website using IE - it might turn away a few users because they dont like using IE for browsing purposes

Just make your site compatiable with all the browsers that will be the ideal solution
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question