|
Hi Guys,
We have an app with 3 tiers a data,bussiness and presentation layer(asp.net 2.0). Any exceptions thrown by the data layer are caught and logged by the business layer, which then throws a custom exception to the ui which displays a simple message to the user which does not divulge any sensitive information to the user.it is unwanted to have a try catch block for every method in the business layer which is growing considerably so i want to catch the unhandled exception in one generic catch for the business layer (see below), this method would log the exception,send out notifications and create new custom exception which would be thrown to the presentation layer. All classes in the business layer would subclass a base class which would have the code that assigns the unhandled exception delegate in its constructor. the code works in an console application but it does'nt work in a Class Library Project which is what our bussiness tier is. The Application_UnhandledException is called if it's in console,or normal windows app but i need this method to be called in a class library project. Any assistance is greatly appreciated,it become very urgent to get this working. Thanks guys
e.g
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
public static void Application_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (e.ExceptionObject is System.Exception)
{
//TODO LOGGING CODE,notifications ETC
}
}
The Global.asax file in the presentation layer would catch the final custom exception in the application error method. The message the user would see is simple e.g An Error Occured. The Error was logged and the support team has been emailed details of the error, please contact you admnistrator for further assistance.So The ErrorPage.aspx would use the innerexception of the exception object (CustomException) and display the simple message contained in it
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
Exception exc = Server.GetLastError();
Session.Add("LastError",exc);
Response.Redirect(@"~\ErrorPage.aspx", true);
}
|
|
|
|
|
The Application_UnhandledException will be called at application level if you don't catch the exception. As you catch it in the presentation layer, it's never unhandled.
You can't make the Application_UnhandledException work in a library, as a library is not an application.
---
b { font-weight: normal; }
|
|
|
|
|
Hi! there is a text box & a button. text box recieved pages ranges to print pages from a given document: 10-20,12,13,21-58 etc. i want a regular expression in javascript to match this pattern.
sam.
|
|
|
|
|
Do you want to match it for validation, or to extract data? Something like this?
"^(\d+(-\d+)?)(,(\d+(-\d+)?))*$"
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I just made a Ajax scripts directory and i need help to add interesting ajax
scripts and tutorial in it.
You can add your own ajax scripts, files, tutorial and your website link into
our website.
www.scriptsajax.com
Gino www.toolurl.com
|
|
|
|
|
i want to add webparts dynamicalyy
i am unable to do it ?
plz send me code how to add webparts and webpartzone at runtime
see the website www.netvibes.com
i want to make somewot like this
thnk you
intresting in asp.net
|
|
|
|
|
When i have created new website from Visual Studio 2005.Error message is displayed with "Visual Web Developer does not support creating Web sites on a SharePoint Web server".i can't created new WebSite in VS2005.
how will it solved ? .please reply me as soon possible.
Jignesh Patel
|
|
|
|
|
hi all
which one is best,
Response.redirect(""),
server.transfer("")
i have pass querystring values
thanks
|
|
|
|
|
Depends upon your requirement.
By both way you can pass the querystring.
Best Regards,
Apurva Kaushal
|
|
|
|
|
That depends on what behaviour you want.
Response.Redirect sends a redirect page to the browser, so the browser will be sending a request for the url that you specify.
Server.Transfer just continues execution in the new file, using the same response.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all!
I need function for adding no of days to a date & return the new date similar in vb.Can someone pls provide reference from where I can get this.
Thanks for your time & help
|
|
|
|
|
|
Here is a prototype that adds an addDays method to the Date type:
Date.prototype.addDays = function(days) { return new Date(this.getTime() + 86400000 * (days)); }
Example:
var now = new Date();<br />
var tomorrow = now.addDays(1);
---
b { font-weight: normal; }
|
|
|
|
|
Thanks Guffa
It works correctly with present date but when I use setDate(year,month,date) to addDays it works incorrectly.Can u assist please
Regards!!
Nitin
|
|
|
|
|
Can you show some code that demonstrates the problem?
The setDate method doesn't take three parameters, only one.
If you use new Date(year, month, date), are you aware that the month value is zero based?
---
b { font-weight: normal; }
|
|
|
|
|
I am able to access and consume my ASP.NET 1.1 WebService from JavaScript (and in fact from a Windows App). No problem.
When I pass a simple string parameter into the WebMethod it is accepted and processed successfully when called from a Windows App.
When I pass the same simple string parameter thru the SOAP Envelope from JavaScript, the WebMethod does NOT receive the param properly.
I am not sure what is missing. The same SOAP syntax works for me in other WebService calls. Why not in this simple case ?
Do I need to dig deeper into my setRequestHeader for some missing header ? Could this be a security related problem ?
I have tried many permutations and reduced the test to a very simplified case shown below:
C# WebService code --
[WebService(Namespace="FinfootSystemsGroupWebServicesNameSpace")]
public class WangoTango : System.Web.Services.WebService
{
public WangoTango()
{
InitializeComponent();
}
[WebMethod]
public string NudgeNudgeWinkWink(string foo)
{
return "|" + foo + "|";
}
}
In JavaScript I set up the following HEADER:
var strContentType = "text/xml"
var strMethodName = "NudgeNudgeWinkWink"
var strNameSpace = "FinfootSystemsGroupWebServicesNameSpace"
var strServiceUrl = "http://localhost/FinfootSystemsGroupWebServiceTest001/WangoTango.asmx"
objXmlHttp.open("POST", strServiceUrl, true);
objXmlHttp.setRequestHeader("MessageType", "CALL")
objXmlHttp.setRequestHeader("Content-Type", strContentType)
objXmlHttp.setRequestHeader("SOAPAction", strNameSpace + '/' + strMethodName);
objXmlHttp.onreadystatechange = getWebServiceResultsAfterLoad
objXmlHttp.send(strEnvelope);
Here is the actual SOAP envelope passed:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:NudgeNudgeWinkWink xmlns:ns1="urn:FinfootSystemsGroupWebServicesNameSpace" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<foo xsi:type="string">TestString</foo>
</ns1:NudgeNudgeWinkWink>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Here is the *empty* xmlhttp responsetext returned:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<NudgeNudgeWinkWinkResponse xmlns="FinfootSystemsGroupWebServicesNameSpace">
<NudgeNudgeWinkWinkResult>||</NudgeNudgeWinkWinkResult>
</NudgeNudgeWinkWinkResponse>
</soap:Body>
</soap:Envelope>
The result is missing the incoming parameter value. What happened to the parameter "TestString" that was passed into the WebService.
Any ideas or suggested directions would be greatly appreciated.
|
|
|
|
|
I downloaded an evaluation copy of Mindreef's SOAPScope 5.2 which presented a variation to my SOAP Envelope.
The following Envelope magically worked and my incoming parameter was miraculously read by the webservice.
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<tns:NudgeNudgeWinkWink
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="FinfootSystemsGroupWebServicesNameSpace">
<tns:foo>TestString2</tns:foo>
</tns:NudgeNudgeWinkWink>
</soapenv:Body>
</soapenv:Envelope>
I am a happy camper now.
|
|
|
|
|
I was just wondering if there is anything like the codebehind feature of .net that could be used in regular .asp? I have a page that basically just loads a java file in it, but I don't want people to see the name of the java file being loaded since they could just download it that way. This is the part that loads the file:
<APPLET CODE = "com.javaplayer.v333.javaPlayer.class"
ARCHIVE = "javaplayer.jar" WIDTH = 720 HEIGHT = 540>
<PARAM NAME = "ARCHIVE" VALUE = "ImPlayer333.jar">
<PARAM NAME = "BGCOLOR" VALUE = "3366FF">
<PARAM NAME = "FILE" VALUE = "javafilename.jar">
If I can somehow "hide" all of that, but still have the page load then great, otherwise I'm not sure what else to try to keep the files safe.
-- modified at 15:44 Thursday 24th August, 2006
|
|
|
|
|
The code behind in .NET doesn't hide anything of the html code, it only separates the html code from the server code. What's sent to the browser is still the same.
You can not hide the applet tag, as the browser has to see it, and if the browser can see it, so can anyone.
You can make it harder to spot the filename, perhaps by using Javascript to write the applet tag to the page, but then the browser needs to have Javascript enabled, or it won't work.
---
b { font-weight: normal; }
|
|
|
|
|
Hi All
I am developing an online shopping web site. The site is similar to any online shopping site where user can select categories from left menu and product will be displayed in middle of page. We had planned to display 6 products per page. As of now we are fine and clear what we need to do.
Main concern is how to bring product data. We are expecting for each category there can be 5000 products and which can grow down the year. Obviously main concern is performance as we are expecting our main users will be dial up users as site will be access from those countries where DSL in not very common. We are in discussion of our product page design and I need your advice which can help me to mitigate any post deployment risks.
I am planning,
1) On Product Page load, I will fetch all the product data (e.g. Product Name, Description, Price, ImagePath, Saleprice, special deals etc…) in DataTable say MyDataTable and cache this DataTable.
2) Now when user clicks on any category from left menus, I will create DataView from cache DataTable by filtering category and bind the DataView with my repeater control.
I believe by this approach I can gain performance hit. For our project performance hit is very critical. Please advice whether I am in correct direction or Not. Please consider this on urgent basis. Thanks in advance for your valuable reply and time
Amit
Amit
|
|
|
|
|
Ïf you really want to cache that amount of data, I would reccomend that you create a class for the product data instead of using a DataTable, to minimize the overhead.
In most cases I would recommend that you just fetch the data from the database, though. Caching all the data uses a lot of memory, and memory is one of the most sensetive resources of the server.
Fetching the data from the database instead of keeping it in memory also scales much better, which is important as you expect the number of products to increase. A database can easily store millions of products, much more than you can hold in memory.
I think that you should start by planning how you should display the products to the user. If you display six products per page from a category with 5000 products, there is more than 800 pages to flip through. Noone will start flipping through all those pages to find a product, so you need a better way to present them to the user.
The weaker link here is not the database, but the user. A database request can easily handle more products than any user can grasp. You just have to find the way to present the products that the user is interrested in.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for your suggestion. So as per my understanding you are suggesting that
on click of category from LHS menu, i fetch (6) products with pagination logic thru stored procedure. And on click of each pagination i fetch next 6 products and so on.
Please confirm.
Thanks
Amit
Amit
|
|
|
|
|
Yes.
---
b { font-weight: normal; }
|
|
|
|
|
is there an equivelant to include external files in .js files similar to C/C++
#include?
thanks.
|
|
|
|
|
FileName.js is your javascript file within the same directory or provide a relative or absolute path as you wish.
Hope that solve your issues.
Regards
Nitin
|
|
|
|