|
Hi, everyone,
I have a question when I use the following code to get the response.
WebRequest req = WebRequest.Create(sURL);
try
{
WebResponse result = req.GetResponse();
}
catch(Exception){}
the code works very well on my XP, but when I run it under Windows server 2000, or some others PC, I sometimes get the exception:
The underlying connection was closed: The server committed an HTTP protocol violation.
it comes with the code GetResponse(). But when I use IE try the Url, IE works.
Would you please tell me why that is happened, and How to avoid/fix that, so I can read the response.
Thanks a lot in advance!!
Alan Shen,
Alan Shen
MCAD for .NET Version
^~^~^~^~^~^~^~^~^~^~^
Great idea is the beginging of success!
|
|
|
|
|
Anyone knows why the following code doesn't work:
typedef CArray< CPoint, CPoint* > CPointArray;
Thanks.
|
|
|
|
|
Hello,
I have a problem with the PrinterSettings.Collate property I receive from a PrintDialog. It always seems to return false. I've tried it with a standalone application that does nothing but show the PrintDialog and return the Collate property afterwards. Is this a known bug, and if so, is there a workaraound for the problem?!
Thx klawipo
|
|
|
|
|
I have an application that communicates with the server program through a shared text file, located at a network directory. The server writes to the text file which my application reads. I am using FileSystemWatcher to monitor this file.
Now when server writes to the file, change event in my application fires after 2 or 3 seconds. However when I manually change this file and save it, it acts the ideal way. I want to reduce this time delay as this should act like realtime system.
My C# code goes like this :
-------------------------------------------------------------------
public MyWatcherClass()
{
watcher = new FileSystemWatcher();
this.watcher.Path = this.MyNetworkDrive;
this.watcher.NotifyFilter = NotifyFilters.Size;
this.watcher.Filter = this.MyTextFile;
this.watcher.Changed += new FileSystemEventHandler(OnChanged);
this.watcher.EnableRaisingEvents = true;
}
-------------------------------------------------------------------
What am I missing?
Thanks in advance
|
|
|
|
|
I remember asking this a while ago and getting an answer *cough* David Stone *cough*, but for the life of me I can't remember how to do it.
I have a Bitmap object, from which I can get the RawFormat. Is there a way I can get a friendly name, such as "JPEG", from the ImageFormat object without having to hard-code a lookup table or writing a clunky lookup function that enumerates the Decoders on the system? IIRC, you can do it in one line.
Thanks,
|
|
|
|
|
Hi,
I download the .NET Framework Version 1.1 Redistributable Package in the station, but when I try to run a .NET C++ application I got an error message
"Application has generated an exception that could not be handled."
The same application runs fine in my development station which has the full Visual Studio .NET installed. (It was ver. 1.0, but I also downlod the .NET Framework Version 1.1 Redistributable Package and SDK 1.1 as well).
Does anyone know what else I have to do to run the application outside of the development station?
Thank you in advance for your help.
|
|
|
|
|
I found out that I have to download NET Framework Version 1.0 Redistributable Package to run the application. After I did that, it works fine.
|
|
|
|
|
Depending on what your application does you might be missing a library assembly (DLL) needed, especially if you are getting the exception when the program is loading. Check the dependencies on your development machine. (If you build a deployment package using VS these any assemblies your application depends on should be packaged in the MSI automatically.)
If that's not it you might try adding an application thread exception handler of your own in an effort to get more information on just what exception is being thrown. For example, in your Main method (but before Application.Run()):
Application.ThreadException += new ThreadExceptionEventHandler(ApplicationThreadException);<br />
Then a simple handler:
static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e) {<br />
string msg = <br />
"A problem has occurred while running CAPA Facilitator:\r\n" +<br />
"\t" + e.Exception.Message + "\r\n\r\n" +<br />
"Would you like to continue running CAPA Facilitator so that\r\n" +<br />
"you can save your work?";<br />
DialogResult result = MessageBox.Show(msg, "Unexpected Error", MessageBoxButtons.YesNo);<br />
<br />
if (result == DialogResult.Yes) {<br />
return;<br />
}<br />
Application.Exit();<br />
}<br />
This will display the exception error message in a dialog befor closing the program, which could provide clues to what's going on.
Hope this helps.
Mitchell
|
|
|
|
|
I try to buikd a strong name signed assembly in Jscript.net.
I am using the following assembly level attribute:
import System;
import System.Resources;
import System.Runtime.InteropServices;
import System.Reflection;
[assembly: AssemblyKeyFileAttribute("keyfile.snk")]
JSC does not complain at all, but the resulting DLL is not signed with a
strong name. Actually JSC does not complain even if keyfile.snk is missing.
CSC does the above job just fine but I prefer Jscript.NET for various
reasons.
SDK version is 1.1
Any feedback appreciated.
Stefan Stefanov
XEROX systems analyst
|
|
|
|
|
I have four questions regarding the following MSIL.
1. If auto is used, the layout of this object in the memory is decided by the runtime. What happens if I do not use auto?
2. How does ansi keyword help in handling interoperability between managed and unmanaged code?
3. What is the use of cil managed?
4. What is the use of specialname, rtspecialname and instance?
.assembly DemoMSIL{}
.class public auto ansi HelloWorld extends [mscorlib]System.Object
{
.method public hidebysig static void HelloWorld() cil managed
{
.entrypoint
ldstr "Hello World."
call void [mscorlib]System.Console::WriteLine(class System.String)
ret
}
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
|
|
|
|
|
instance is used to indicate that the method is an instance method and not a static method.
Regards
Senthil
My Blog
|
|
|
|
|
|
To all,
Does anyone know how one can remove/reset the "Look In" history in the "Find in Files" dialog in the VS IDE? It is very annoying when I type in a wrong directory by mistake and it gets in the way forever.
Greatly appreciated.
|
|
|
|
|
I am using the openfiledialog in my project. Sample code: at bottom
I get a blank filename when I get a return back from the dialog.
This happens after I pick a file (any file).
Now when I run the same code on my other computer (laptop), it functions normally. What can cause this to happen?
I am not having any other system problems (that I know of), and this is really wierd.
Any ideas? (Framework 1.1) xp servicepack 2 ( I think I am fully upgraded software wise.)
If ofd.ShowDialog() = DialogResult.OK Then
'Load the excel import file into a datatable
PartsTrakCommonLibrary.PartTrakCommonLibrary.FillDataTableFromExcel(dtImportData, ofd.FileName)
End If
Thanks,
Foxjazz
|
|
|
|
|
Hi,
I had the same problem when I tried to preload some C-Dlls before the main window was shown.
When I loaded them after showing the first window, it worked fine.
hope that helps.
Good luck, klawipo
|
|
|
|
|
Anyone know of a free DLL reader. I have a dll that the company used back in the day and no source is available.
The programmer is no longer with company. Grrr.
Thanks is advance.
*****************
"I know how hard it is for you to put food on your family." —GW
|
|
|
|
|
For .Net-Assemblies there is the .Net Reflector, available e.g. at
http://www.aisto.com/roeder/dotnet/
If you're lucky, this tool may show you the complete source code.
For unmanaged dlls you can use the old dependency walker,
probably available somewhere at microsoft.
This tool can only tell you about exported functions and types.
tell me if this helped.
Good luck,
klawipo
|
|
|
|
|
The .NET TextBox control automatically provides a nice context menu that pops up when the user right-clicks in it with all the stuff expected, like Cut, Copy and Paste (and some surprising ones, like right-to-left selection, etc.). However, if you add a context menu component of your own you lose the one provided. Does anybody know a way to find and merge with the default menu? I've been trying to add an item to call a spell checker I've added to my project and don't want to have to duplicate all of the nice things the TextBox already provides on its default context menu... Any thoughts?
Thanks in advance for any help!
Mitchell
|
|
|
|
|
hi dear i am facing the same have u any solution now.
please reply me pankajupadhyay29@gmail.com if u can
|
|
|
|
|
Hi, Does anyone know if the memory functions in the Process class return bits or bytes or what? I'm using the methods to get a Process's memory it's not giving me the same amount as shown in taskmanager. For instance the process for the program I created returns these ints with these functions which don't seem to match up with task manager.
{Returns} {Function Called}
Physical Memory: 20586496 (WorkingSet)
Min Physical Memory: 204800 (MinWorkingSet)
Max Physical Memory: 1413120 (MaxWorkingSet)
Non Paged System Memory Size: 24832 (NonpagedSystemMemorySize)
Paged Memory Size: 10211328 (PagedMemorySize)
Paged System Memory Size: 71868 (PagedSystemMemorySize)
Peak Paged Memory Size: 10211328 (PeakPagedMemorySize)
Peak Virtual Memory Size: 194551808 (PeakVirtualMemorySize)
Peak Working Set: 20701184 (PeakWorkingSet)
Virtual Memory Size: 194506752 (VirtualMemorySize)
Taskmanager shows
Mem usage: 30,624K
Peak Mem usage: 30,632K
VM size: 19,104K
Paged Pool: 69K
NP Pool: 23K
|
|
|
|
|
The values returned by those functions are snapshots, they don't change dynamically.
Regards
Senthil
My Blog
|
|
|
|
|
I realize they are shapshots, I took the readings of both at the exact same time, the amount of memory used is not changing. The problem is none of the functions in .NET seem to give me the same amount of memory Windows Taskmanager does. I checked it for all processes running on my machine, and taskmanager gives different results then .NET every time for me.
Thanks
|
|
|
|
|
Hi, I have the following problem:
I need to set the property of a child control of a form, but from an external form. The truth is i have no idea on how to procced to do this,
- do I need to make the owner form aware of the event occured in the external form in order to reflect the change? (change this property)
- or somehow i can refer to the the instance of the owner form from the external form so i can change this property?
Either ways i dont know how to do this, as you can see I'm lost
PS: I've asked on many forums and newsgroups and noone replies me!, I'm hoping for some codeproject geeks to show up
|
|
|
|
|
please tell me . microsoft visio 's document where store the all information of document. like if i give custom properties of document where it save internally . can i see it witout open visio and other property who create it
.is it save any table
freetoyoula
|
|
|
|
|
I have been beating myself up over trying to locate what I thought was a memory leak in MY code but based upon what I have seen I can't be sure that it IS my fault or something strange with DOTNET. Someone here please feel free to enlighten me on this one.
The code to reproduce is very simple. Done in VB.NET (please no language based flames here - I am already working up a C# version just to be safe ) , One form with a button on it called cmdStart. Here is the code behind the form:
Public Class Form1
Inherits System.Windows.Forms.Form
Dim t1 As System.Threading.Thread
Dim t2 As System.Threading.Thread
Dim t3 As System.Threading.Thread
Dim t4 As System.Threading.Thread
Dim t5 As System.Threading.Thread
#Region " Windows Form Designer generated code " 'This has been clipped out for brevity here
Private Sub ThreadWorker()
Do
Debug.WriteLine("Thread Enter. [" & System.Threading.Thread.CurrentThread.Name & "]")
System.Threading.Thread.CurrentThread.Sleep(1000)
Debug.WriteLine("Thread exit [" & System.Threading.Thread.CurrentThread.Name & "]")
Loop
End Sub
Private Sub cmdStart_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdStart.Click
t1 = New System.Threading.Thread(AddressOf ThreadWorker)
t1.Name = "T1"
t1.IsBackground = True
t1.Start()
t2 = New System.Threading.Thread(AddressOf ThreadWorker)
t2.Name = "T2"
t2.IsBackground = True
t2.Start()
t3 = New System.Threading.Thread(AddressOf ThreadWorker)
t3.Name = "T3"
t3.IsBackground = True
t3.Start()
t4 = New System.Threading.Thread(AddressOf ThreadWorker)
t4.Name = "T4"
t4.IsBackground = True
t4.Start()
t5 = New System.Threading.Thread(AddressOf ThreadWorker)
t5.Name = "T5"
t5.IsBackground = True
t5.Start()
End Sub
End Class
Now, you ask what the problem is here? It appears to me that there is a memory leak afoot.At least according to perfmon.
When I monitor the privateBytes for the test app running these threads and sample every 60 seconds I get a very definite memory increase shown.
My question here is WHY?!? My thread is not creating any resources unless you count anything allocated internally by the framework to perform the debug prints. I am testing this running debug build of the app and to be honest I have not tested a release build yet so I cannot comment on what those results are.
Now, keep in mind that my app is MUCH more complicated than this, but I am seeing the same results here as I am in my app. I thought originally that I was seeing some memory issues because I was creating a clone of a few hashtables inside my threads and I thought perhaps that was causing some GC issues but now I am not so sure. In fact when I ran my app with all the internals of the threads commented out except for the debugs and sleeps as I have here I still see the apparent memory creep.
Can ANYONE explain to me what I am seeing here?
Am I going nuts?
I have to admit that I am by no means a threading master yet but this seems pretty basic to me.
The even stranger part is that, while I am typing this in I happened to look at perfmon and see that it appears to have eventually leveled off after about 14 minutes. The memory appears to have gone from 6654720 to approx 7772000. That is a growth of 117280 bytes. Not allot but I still don't understand why the memory is growing. Can this all be explained away by GC? Seems a bit odd since I am not allocating anything in my app on a cyclic basis.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|