|
MrJJKoolJ wrote:
Can I use messagebox object inside a webservice?
You can't.
MrJJKoolJ wrote:
cb.GetInsertCommand();
cb.GetUpdateCommand();
These lines are not needed. They will set automaticlly.
MrJJKoolJ wrote:
Console.WriteLine("An exception occurred. Please contact your system administrator.");
If you want to inform user an error occured , you can thrown SoapException and report it in your client. That line won't work. Also you can return a error code instead od throwing exception
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
Hi Mazy,
How do I return an Error code back to the client from web service?
Thanks,
JJ
|
|
|
|
|
Just set return value as an integer , which you can define for yourself that each number refer to specific error. You can return it in your catch block and outside it return 0 , just like many of win32 API do. Other way as I mentioned throwing SoapException which could be caught in client. You can search for it in Google for sample. Hope it helps.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
Hi Gurus,
i am using following code to send request to php page on button click function:
HttpWebRequest request = (HttpWebRequest) WebRequest.Create("http://www.umc.ua/misc/sendsms.php");
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
string postData = "network1="+oper.Text+"&Phone1="+phone.Text+"&Message="+text.Text+"&sender_name=sn";
byte[] buffer = Encoding.ASCII.GetBytes(postData);
request.ContentLength = buffer.Length;
Stream s = request.GetRequestStream();
s.Write(buffer, 0, buffer.Length);
s.Flush();
s.Close();
But when I lauching my program and clicking much times on to invoke this code an exception occurs:
"Unable to write data to the transport connection"
It happens aproximately every 10-15 times. Could someone tell what wrong with my code? Thanx
www.xedom.com
|
|
|
|
|
First, you should encode the param values or they could be used to crack your CGI and beyond.
Second, are you actually getting the response from the server using request.GetResponse , or are you just queueing requests?
Finally, are the param values the same each time you click the button in your test case?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
Second, are you actually getting the response from the server using request.GetResponse, or are you just queueing requests?
I was gonna mention that, but I havent used it in such a long time, I thought I'll rather let someone else do it
|
|
|
|
|
Yes, all parameters are the same. Let imagine that this is one dialog with single button and all code are implemented in OnButton click function. This button just sends an sms to a mobile through php page, so I do not need any server response. But when I sending 20-30 sms during 10 min. after each 10-15 clicks I got this exception message. Can you tell me how can I encode my param values? Thanx for reply.
www.xedom.com
|
|
|
|
|
You could either reference the System.Web.dll assembly, or the JScript.NET assembly (don't remember off-hand what it's called) and use the HTML encoding method in there, or just do a simple replacement yourself, using Uri.HexEscape for all ASCII characters about 127 (implementing this your isn't hard either - just replace the character with &#XXX; where XXX is the decimal number equivalent. So, character 128 would be €.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am trying to pass a parameter to one of the OnSelectedIndexChanged events. Is this even possible ?
Code-Behind is C#.
Here's the Front-End Sample..
<asp:dropdownlist autopostback="True" id="SomeID" runat="server" onselectedindexchanged="ChangeIndex">
Here's What I want to achieved..
<asp:dropdownlist autopostback="True" id="SomeID" runat="server" onselectedindexchanged="ChangeIndex(1)">
So my method is ChangedIndex. Usually, if i leave it as is,
it will work. But I'm trying to make a generic function that
can be use for all.
Code-Behind.
public void ChangeIndex(object sender, EventArgs e)
{
do some stuff..
}
this works, but no parameters.
I tried:-
public void ChangeIndex(int i_temp)
{
do some stuff..
}
this gave me error.
Any sample syntax is appreciated.
Stanley
|
|
|
|
|
Which control are you talking about? More than one control in WINDOWS FORM have this event. Most of them have the property name SelectedIndex or SelectedItems which you can use to get that value.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
I think its related to webforms
|
|
|
|
|
Sorry for being unclear.
Yeah, it's webform related.
Stanley
|
|
|
|
|
I found it out. This is posted in ASP.NET forum too.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
If you haven't yet solved your issue, please see my reply in the ASP.NET forum.
--Jesse
|
|
|
|
|
Hello,
I am currently having a hard time finding any good references for the needleman wunsch algorithm to learn and implement it in C#.
Does anyone please have a reference or can help me by supplying pseudo or proper code?
10x
Andrew Cortis
|
|
|
|
|
Sounds like a lunch meat. You should google on "Needleman Wunsch java", in my opinion; here's a result to get you started:
http://www.dina.dk/~sestoft/bsa.html
It's ridiculously easy to port code from Java to C#, and you're probably going to have better luck in general finding science- or math-oriented code written in Java.
-Jeff
here, bloggy bloggy
|
|
|
|
|
10x a lot. I'm not a java guru, but I'll try to understand it from Java code.
|
|
|
|
|
I think you'll find it easier than you think, and if you have questions, come back and see us. Good luck.
-Jeff
here, bloggy bloggy
|
|
|
|
|
Does somebody know in which Dll and Namespace I can find
the Session - Object (if there is any )? thanks
|
|
|
|
|
Which Session do you mean? The one in ASP.NET? System.Web.SessionState Namespace ?
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
If you actually read the documentation, you'd see that it's in the System.Web.dll assembly under the System.Web.SessionState namespace (as Mazdak mentioned). You can't simply just use it, though. It's bound to the current HttpContext for a user. You can get this from the HttpContext.Current property (returns the current HttpContext , the class which defines a Session property) and the Page class.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
here is my log file from fuslogvw.exe
*** Assembly Binder Log Entry (5/6/2004 @ 10:49:28 AM) ***
The operation failed.
Bind result: hr = 0x800704c7. The operation was canceled by the user.
Assembly manager loaded from: C:\WINNT\Microsoft.NET\Framework\v1.1.4322\fusion.dll
Running under executable C:\Program Files\Droplet\Server\DropletConsole.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = DotNetAppHost, Version=1.0.0.0, Culture=neutral, PublicKeyToken=15043562efa7be39
(Fully-specified)
LOG: Appbase = C:\Program Files\Droplet\Server\
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : DotNetAppTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=15043562efa7be39.
===
LOG: Processing DEVPATH.
LOG: DEVPATH is not set. Falling through to regular bind.
LOG: Publisher policy file is not found.
LOG: Host configuration file not found.
LOG: Using machine configuration file from C:\WINNT\Microsoft.NET\Framework\v1.1.4322\config\machine.config.
LOG: Post-policy reference: DotNetAppHost, Version=1.0.0.0, Culture=neutral, PublicKeyToken=15043562efa7be39
LOG: Cache Lookup was unsuccessful.
ERR: A fatal error occurred when retrieving next codebase for download (hr = 0x800704c7).
i can't figure out what the error is. did it fail to find one of the assemblies - DotNetAppHost or DotNetAppTest?? or is it something else??
thanks.
|
|
|
|
|
DotNetAppTest is the calling assembly. The exception is either in DotNetAppHost or it can't find DotNetAppHost (most likely the latter since Fusion is giving you such a log). The log seems incomplete for an assembly binding error, though, since it doesn't seem to be probing additional, common paths, unless you've removed those lines.
If the assembly was missing, you should've been thrown a FileNotFoundException , which you've either not reported here or are catching in the Application.ThreadException or AppDomain.UnhandledException event handlers (or in a method that late-binds against DotNetAppHost).
To accurately help you solve the problem, please provide more information, such as the complete log (it applicable) or any exceptions that were thrown.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
thanks for the quick reply. that is the complete log. when i look at the output window in VS, i see that both DotNetAppHost and DotNetAppTest are loaded.
|
|
|
|
|
What exactly is the error you're getting, though? Is there any exceptions being thrown from your app (or being caught)?
Microsoft MVP, Visual C#
My Articles
|
|
|
|