|
Mickt1985 wrote: I read very conflicting articles Which just means that everyone has their own opinion. It's up to you to choose which one you think is right.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Although everyone have their own opinion but the main important thing is user should not experience unexpected behavior. if there is something going wrong you need to catch and that could be possible through try..catch and logging the messages.
so resolving errors are more important then best practice... keep coding...
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
I understand that with tools like Codeit.right and The Visual Studio Analysis that Try Catch(s) are to be used sparingly and to catch only certain types of errors. You should try to wirte tests into the code in order to narrow the parameters of the code so that you will be able to report back to users problems. Hiding errors in Try / Catch in not the proper use of the machanic.
Hope this sheds some light on the use.. Try running the code by removing all the Try/Catch and if there is a better way like a If/Then that can cover the error then it is so much better.. in Addition Try/Catch are generally slower.
Regards.
|
|
|
|
|
Thanks very much for your reply.
|
|
|
|
|
If you are interested in executing a certain block of code irrespective of whether an exception occurs or not and still worry about catching an exception you might use the try-catch-finally block. Even if a goto statement is present in a try block, the control gets transferred to the label in the goto, only after executing the finally block.
You should try and use them in your code as much as possible, especially if you suspect a particular error may crash your programme.
Comm100 - Leading Live Chat Software Provider
modified 28-May-14 1:49am.
|
|
|
|
|
Hi,
I would like to ask what's the best way to send bulk SMS? if you had an option from the following, which one you'll choose and why please?
HTTP/S, FTP, SMPP, XML, SOAP, SMTP or COM object
Thanks,
Jassim
http://www.JassimRahma.com[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
requires:
:~neither use the plugin of flexpapper nor the MS's office component
|
|
|
|
|
Hi,
I had been given a WCF service endpoint for net.tcp and http binding both. I want to generate proxy for this wcf service. But when I am running the svcutil from VS command prompt as administrator, it is giving me the below errors.
When I run the
C:\Windows\system32>svcutil.exe /language:vb /out:D:\WSDLRepository-Proxy\DocRetrieveService\DocRetrieveService.vb /config:D:\source\SourceCode\StayatWork-VS2010\BusinessLogicLayer\app.config http://xxxxxxtumecr21:8000/FilenetDocRetrieve/DocRetrieveService?wsdl
command
I am getting the below error
WS-Metadata Exchange Error
URI: http://xxxxxtumecr21:8000/FilenetDocRetrieve/DocRetrieveService?wsdl
Metadata contains a reference that cannot be resolved: 'http://lnidaptumecr21:8000/FilenetDocRetrieve/DocRetrieveService?wsdl'.
<?xml version="1.0" encoding="utf-16"?><Fault xmlns="http://www.w3.org/2003/05/soap-envelope"><Code><Value>Sender</Value><Subcode><Value xmlns:a="http://www.w3.org/2005/08/addressing">a:ActionNotSupported</Value></Subcode></Code><Reason><Text xml:lang="en-US">The message with Action 'http://schemas.xmlsoap.org/ws/2004/09/transfer/Get' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</Text></Reason></Fault>
HTTP GET Error
URI: http://xxxxxtumecr21:8000/FilenetDocRetrieve/DocRetrieveService?wsdl
The document was understood, but it could not be processed.
- The WSDL document contains links that could not be resolved.
- There was an error downloading 'http://localhost:8000/FilenetDocRetrieve/DocRetrieveService?wsdl=wsdl0'.
- Unable to connect to the remote server
- No connection could be made because the target machine actively refused it 127.0.0.1:8000
If you would like more help, type "svcutil /?"
But when I run the
svcutil.exe /language:vb /out:D:\WSDLRepository-Proxy\DocRetrieveService\DocRetrieveService.vb /config:D:\source\SourceCode\StayatWork-VS2010\BusinessLogicLayer\app.config http://lnidaptumecr21:8000/FilenetDocRetrieve/DocRetrieveService?wsdl
Command
I am getting the following error
Error: An error occurred in the tool.
Error: The given path's format is not supported.
Can anybody please help me in resolving it, I want to generate a proxy for my wcf clinet without using add service reference.
Because I dont want to make my client environment dependant. Any link or any kind help is great. Its urgent please help me.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
modified 29-Nov-12 19:33pm.
|
|
|
|
|
Hi,
Just give this a try, not sure about that. but instead of single slash in config file path use double slash. all the directory file path with double slash(\\).
so your command become,
svcutil.exe /language:vb /out: D:\\WSDLRepository-Proxy\\DocRetrieveService\\DocRetrieveService.vb /config: D:\\source\\SourceCode\\StayatWork-VS2010\\BusinessLogicLayer\\app.config http://lnidaptumecr21:8000/FilenetDocRetrieve/DocRetrieveService?wsdl
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Hi all,
I need to integrate the Paypal for online credit Card processing .
I dont have pervious experience of integrating paypal . can any body share the ideas
Regards,
|
|
|
|
|
Go to the PayPal website; they will provide all the information you need.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi code project world!
My Question is that :
I have written a "web application" via ASP.net 2008 and SQL database 2008.
I wanna use this source for multiple websites with different Master pages and CSS.
1) what is the simplest way/Solution to do that ?
2) if i change the main source code (one will be the main that i make changes to that) how can update other websites that uses this code(but with different Master pages and CSS)?
Thanks is advanced!
|
|
|
|
|
webpage is published successfully in windoms xp iss.... but page is not redirect another page when it call....... any one solve this problem to me .. i ready to pay for you 1000RS...... contact me if you know solution for this.. dineshk61@gmail.com
|
|
|
|
|
Please provide full technical details of your problem, as it stands there is no real way anyone can guess what you may be doing wrong. And do not offer money (answers are provided free here), or put your email in publicly available messages.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hello Guys,
I am new to .Net could you please tell me what are the controls used in ASAP.Net ?
Thanks,
Vani
|
|
|
|
|
Controls in asp.net consist of several categories such as HTML elements, but can be used directly on a web form or in code behind.
So web designers just starting out can drag and drop a control from the toolbar onto a web form, and experts can just type pure code to build sections of a web page.
If you have a specific question about controls, feel free to ask.
|
|
|
|
|
Read this[^]. It's the documentation and it's where you should start.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
|
I am getting this while import and exporting data to Excel file
Quote: Microsoft Office Excel cannot access the file 'C:\usr\SVN\ePROM\EffOnePMA\Files\QuestionStructure.xls'.
There are several possible reasons:
• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.
Here I am Attacheing my code
private void DownLoadStrcture()
{
Excel.Application xlApp;
Excel.Workbook xlWorkBook;
Excel.Workbook xlTempWorkBook;
Excel.Worksheet xlWorkSheet;
Excel.Range range;
range = null;
int rCnt = 2;
int cCnt = 2;
string str;
string fname = "QuestionStructure.xls";
string Filepath = Server.MapPath("~/Files/" + fname);
string TempFilename = "QuestionStructure_ " + Convert.ToInt32(Session[PageBase.SESSION_USER_ID]) + ".xls";
string TempFilepath = Server.MapPath("~/Files/Temp/" + TempFilename);
string dep = ddlDepartment.SelectedItem.Text.ToString();
string area = ddlArea.SelectedItem.Text.ToString();
string category = ddlCategory.SelectedValue != "-1" ? ddlCategory.SelectedItem.Text : "";
string subCategory = ddlSubCategory.SelectedValue != "-1" ? ddlSubCategory.SelectedItem.Text : "";
xlApp = new Excel.Application();
xlWorkBook = xlApp.Workbooks.Open(Filepath, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
range = xlWorkSheet.UsedRange;
File.Copy(Filepath, TempFilepath);
xlWorkBook.Close();
xlApp.Quit();
releaseObject(xlWorkSheet);
releaseObject(xlWorkBook);
releaseObject(xlApp);
xlApp = new Excel.Application();
xlTempWorkBook = xlApp.Workbooks.Open(TempFilepath, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
xlWorkSheet = (Excel.Worksheet)xlTempWorkBook.Worksheets.get_Item(1);
range = xlWorkSheet.UsedRange;
str = (string)(range.Cells[rCnt, cCnt] as Excel.Range).Value2;
string[] stringArray = new string[] { dep, area, category, subCategory };
for (int i = 0; i < stringArray.Length; i++)
{
(range.Cells[rCnt, cCnt] as Excel.Range).Value2 = stringArray[i].ToString();
str = (string)(range.Cells[rCnt, cCnt] as Excel.Range).Value2;
rCnt++;
}
xlApp.DisplayAlerts = false;
xlApp.ScreenUpdating = false;
xlApp.Visible = false;
xlApp.UserControl = false;
xlApp.Interactive = false;
string Deletefilepath = Server.MapPath("~/Files/Temp/");
if (File.Exists(Deletefilepath + TempFilename))
File.Delete(Deletefilepath + TempFilename);
xlTempWorkBook.Close(SaveChanges: true);
Marshal.ReleaseComObject(xlTempWorkBook);
xlApp.Quit();
GC.Collect();
GC.WaitForPendingFinalizers();
Marshal.FinalReleaseComObject(xlTempWorkBook);
Marshal.FinalReleaseComObject(range);
Marshal.FinalReleaseComObject(xlApp);
}
|
|
|
|
|
Dear All,
After following instruction from the excellent article by Panayotis Matsinopoulos for setting up a multi-language interface -
Allow users to select the user interface language in your ASP.NET Web application
I went to debug it using the built-in debugger in Visual Studio (VS) and received an error that the class module cannot be loaded. I know it is finding the module because if I move it to a different location in my project, it specifies that it cannot find the module.
This got me thinking about the whole subject of httpModules and their deployment on a localhost webserver and also use in VS debugging and I now have the following questions as a new and aspiring .NET programmer -
1. Does using the VS debugger make a difference? Does for example the module need to be registered separately ahead of time somehow on the localhost? Does it make a difference that the web.config file, the class module for the LanguageModule and the page itself (as well as the App_GlobalResources files) are all inside the same VS project?
2. Does the httpModule need to be registered separately on the local IIS for the application? I mean, I'm sure it needs to be so registered if I am running the application in a browser outside of Visual Studio, - but what about from within VS using the debugger? Doesn't the built-in compiler in the Debugger handle this (registration)?
3. If none of the above are issues in using the VS debugger, how can I go about debugging why the module won't load?
Thanks everyone for your assistance. I hope this isn't too much of a newbie question for the esteemed company!
Best Regards,
Ray Fischer, Kibo, Germany
|
|
|
|
|
If you have an issue with a CodeProject article then please first post your question in the forum at the end of the article. In this way the author will be notified of your query.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Thanks Richard for your answer. I can post it there as well, I was just not sure because this is more of a general question relating to VS and the debugger there and not so much having to do with the method shown.
|
|
|
|
|
Hi All,
I have a WCF Service (Ex name: MyWCFService) which has all the database access and business logic mechanism, which is hosted in IIS using BasicHttpBinding. This WCF service is created by me. One of my collegue also created a WCF service called JasonProxyService which consumes MyWCFService, converts the result into Jason and gives it to UI, UI is using Ajax. The JasonProxyservice doesnt have configuration (like in web config it doesnt have elements <services>, <service> etc, which is unusual for me), and this JasonProxyservice has only two files .svc and svc.vb added to an asp.net application which has the UI also (the asp.net application has all the UI and ajax etc). There is no interface for contract, the ServiceContract attribute is defined right on top of the class and the methods in the class are defined with OperationContract attribute on top of them. When I tried to add interace and define it as service contract and put the WCF service configuration in the webconfig file, simply the Ajax isnt working. Then I left that option.
The reason for keeping JasonProxyService and UI in the same project is to avoid cross domain, becuase Ajax doesnt allow cross domain and our organization also not interested in cross domain because of security. The developer who wrote JasonProxyservice has left the project. Now it has come to my plate. This is what the problem is. I am really struggling with it for a while.
For solution, as first step I wrote logger to understand what is the problem, I am getting the below exception, and I am new to the json world. Please help me. Below is my exception, any help would be really helpfull.
System.ServiceModel.ProtocolException: The content type text/html of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>500 - Internal server error.</title>
<style type="text/css">
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
'. ---> System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- End of inner exception stack trace ---
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at WA.LNI.StayAtWork.Public.Web.StayAtWorkServiceReference.IStayAtWorkService.SetContactInfo(UserInfo userInfo)
at WA.LNI.StayAtWork.Public.Web.StayAtWorkServiceReference.StayAtWorkServiceClient.SetContactInfo(UserInfo userInfo) in D:\source\SourceCode\StayatWork-VS2010\WA.LNI.StayAtWork.Public.Web\WA.LNI.StayAtWork.Public.Web\Service References\StayAtWorkServiceReference\Reference.vb:line 2848
at WA.LNI.StayAtWork.Public.Web.JSONProxyService.SetContactInfoJSON(UserInfo dto) in D:\source\SourceCode\StayatWork-VS2010\WA.LNI.StayAtWork.Public.Web\WA.LNI.StayAtWork.Public.Web\JSONProxyService.svc.vb:line 359
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
That's like finding a needle in the haystack. I would start the debugger up again and F9 the lines below,add some watches and step through the values.
D:\source\SourceCode\StayatWork-VS2010\WA.LNI.StayAtWork.Public.Web\WA.LNI.StayAtWork.Public.Web\Service References\StayAtWorkServiceReference\Reference.vb:line 2848
D:\source\SourceCode\StayatWork-VS2010\WA.LNI.StayAtWork.Public.Web\WA.LNI.StayAtWork.Public.Web\JSONProxyService.svc.vb:line 359
|
|
|
|
|
Hi jkirkerx,
I resolved it, actually it was another problem so it was throwing exception because of a field in the database is not matching to what I am sending.
So that exception was unable to be read by the jason application. So this error.
Thanks for your suggestion.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|