() in attribute declaration
I have seen attributes, specifically Serializable declared in 2 ways and was
wondering if anyone had any insight on the differance if there is any. These
2 ways are [Serializable] and [Serializable()]. Does the addition of the
parenthesis do anything? Is this calling a constructor? Both seem to have the
same effect in the end, but it seems like they should do something differnt? Tag: .NET Windows Forms Security Tag: 138007
System.Timers.Timer and Close/Dispose
The short form of this post is as follows. For an instance of
System.Timers.Timer, after setting Enabled to False, is there a foolproof way
to tell if an Elapsed event will or will not fire?
The long form follows. I have a class, MyClass, that declares
Private WithEvents MyTimer As System.Timers.Timer
Sub New for MyClass initializes MyTimer to fire Elapsed events every second.
I have an Elapsed event handler and some public methods. With SyncLock,
I've made MyClass instances thread safe. Everything works fine.
System.Timers.Timer has Close and Dispose methods, so I when I want to
destroy an instance of MyClass, I should Close or Dispose MyTimer. I've
coded MyClass.Close to look like this:
MyTimer.Enabled = False
' some cleanup I need to do
Sleep(100) ' let fire an enroute MyTimer.Elapsed
MyTimer.Dispose() ' per IDisposable
' some more cleanup I need to do
The reason for the Sleep is because of how Windows/.NET executes
MyTimer.Elapsed events. The Timer.Stop documentation says:
"The Elapsed event is raised on a ThreadPool thread, so the event-handling
method might run on one thread at the same time that a call to the Stop
method runs on another thread. This might result in the Elapsed event being
raised after the Stop method is called."
Stop and Enabled=False do the same thing. The Timer.Stop documentation goes
on to give a somewhat elaborate mechanism to overcome contention and race
conditions that might arise. My solution is Sleep(100).
I don't like my use of Sleep. I don't like the elaborate mechanism in the
documentation because it looks like it could fail if someone is messing with
thread priorities (note that the mechanism uses Sleep(0)).
So, the question is: For an instance of System.Timers.Timer, after setting
Enabled to False, is there a foolproof way to tell if an Elapsed event will
or will not fire? Tag: .NET Windows Forms Security Tag: 138004
Good C# profilers?
Hi...
I was just wondering what recommendations people had for C# code profilers?
I'm trying to figure out where a lot of our app's time is going.
I downloaded and am trying ProfileSharp Enterprise Edition, but I'm finding
the interface awkward and the results suspect (profiling for cpu cycles, it
says Thread.Sleep is the most expensive function).
Has anyone had particularly good experience with a C# code profiler?
Thanks
Mark Tag: .NET Windows Forms Security Tag: 138003
EnterpriseLibrary.Logging
Hi all,
I have installed EnterpriseLibrary v3.1 (latest version) on my pc. When I
create the app.config file using the "EnterpriseLibrary Configuration"
utility, I get an error saying it can't detect the EL.Logging.dll file. I
fixed the problem by setting the PublicKeyToken= "null" instead of its
default PublicKeyToken="b03f5f7f11d50a3a".
eg.
configSections>
<section name="loggingConfiguration"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0,
Culture=neutral, PublicKeyToken=null" />
<section name="exceptionHandling"
type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings,
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0,
Culture=neutral, PublicKeyToken=null" />
</configSections>
The thing is that I can't understnad why this error is occuring in the first
place. This pc is newly set-up and it has never had any prior versions of EL
installed on it. The "EnterpriseLibrary Configuration" utility comes with
this v3.1 setup.
Thanks for your reply.
regards,
Andrew Tag: .NET Windows Forms Security Tag: 137998
GDI and Rotating Text
Hi,
I want to use GDI to rotate some text at an angle and output the
resultant image to the asp.net response stream.
I can do that all fine, however what I'm struggling with is trimming
the whitespace from the resultant image.
What im doing is creating a blank canvas image (of arbitrarily large
size) and doing a translate transform to the centre, then applying a
rotate transform, then writing my text.
What i want to do is trim all the whitespace from around the edges. Is
there some way i can determine the width and height of the text ive
written to the image (after the transform) ?
I know i can manually get the text dimensions before the rotate, then
use some trig to work out how high and wide it would be after rotating
it but thats a bit of a pain if theres some function that will do it
for me
Thanks for any advice
Andrew Tag: .NET Windows Forms Security Tag: 137996
Fold and unfold easily code
Hi,
I am looking for some addin-plugin-external tool for Visual Studio
2005 that would allow me to fold/unfold parts of the code in an easy
way. I don't like the default VS fold mode, its behavior is usually
unpredictable for me.
Thanks Tag: .NET Windows Forms Security Tag: 137995
System.Net.Mail issue
Hi,
I'm using System.Net.Mail to send email in C#.
When I have word "do not" in the mail's body, I couldn't get the mail.
THis is wired, any idea?
Thanks.
William Tag: .NET Windows Forms Security Tag: 137987
framerwork distriburion - licence
I'd like to distribute the .NET framework with my application. I'm
wondering about the license. My application is being created with
Borland Delphi 8 (with .NET) - I've the license for that product. So
the question is: may I distribute the .NET framework with my app?
I was trying to find this information on the Microsoft's web page -
but I've found it impossible.
Please help me,
cezar Tag: .NET Windows Forms Security Tag: 137984
Windows service startUp error
Hi all,
My question consists of 2 parts:
1) I have installed my windows service [by right-click on Setup.exe in
SolutionExplorer, then Install ... ] onto a folder on my desktop. When I
click on the MyNewService.exe file, I got the following error message:
" Cannot start service from the command line or a debugger. A Windows
Service must first be installed (using installutil.exe) and then started with
the ServerExplorer, Windows Services Administrative tool or the NET START
command. "
2) Is the problem because I need to install using "installutil /i
C:\MyNewService3.exe" ?
I tried that and i got the error message:
" Exception occurred while initializing the installation:
System.IO.FileNotFoundException:
File or assembly name Documents, or one of its dependencies, was not found. "
Any advice on understanding what this message says ?
Thanks.
regards,
Andrew Tag: .NET Windows Forms Security Tag: 137978
Caching of DateTime.Now?
Hi...
We have some elapsed time stopwatches using the QueryPerformanceCounter()
win32 api, but since I was getting tired of doing the arithmatic all the time
I added some DateTime.Now.ToString("HH:mm:ss.fff")'s to the log and I noticed
an interesting quirk.
There's often about a 5ms difference between the calculations of
QueryPerformanceCounter() values and DateTime.Now and DateTime.Now is always
the one behind.
Is DateTime.Now cached for some period of time to avoid the expense of
recalculation?
Thanks
Mark Tag: .NET Windows Forms Security Tag: 137977
File Copy exception
Hi all,
I have created a windows service (my first service). I am normally an
ASP.NET developer...
The service is simple. All it does is to watch a directory and copy any
files that land in it to another folder (in this case, the parent folder).
This works fine most of the time, but my first sample file crashed it. It
seems to be down to a file type problem.
My sample file was a .bat file.
I have now put a try/catch around the file copy and come up with
_COMPlusExceptionCode -532459699
At the moment, it only seems to crash with .bat files. I have done a
successful copy of app.config, *.txt. Any ideas?
My code...
public MyService()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
FSWatcher.Path = ConfigurationManager.AppSettings["WatchPath"];
}
protected override void OnStop()
{
// TODO: Add code here to perform any tear-down necessary to
stop your service.
}
private void FSWatcher_Created(object sender,
System.IO.FileSystemEventArgs e)
{
try
{
System.IO.File.Copy(e.FullPath, "C:\\temp\\" + e.Name);
}
catch (Exception ex)
{
}
}
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available Tag: .NET Windows Forms Security Tag: 137975
Create Visual Studio Tools for Office Projects
Hi. I've downloaded & installed the Visual Studo Tools for Microsoft Office.
I have both Visual Studio 2005 Pro & Microsoft Office 2007 Pro installed.
I'm trying to create my first Office project, but I don't see 'Office' as an
available Project Type.
I'm following the directions shown here:
http://msdn2.microsoft.com/en-us/library/0es5szt7(VS.80).aspx
Has anyone seen this before? Any ideas why 'Office' isn't an available
project type.
Thanks. Tag: .NET Windows Forms Security Tag: 137974
Metafile & Graphics
I have a Metafile and a Graphics attached to it and I do several drawings on
the Metafile through the Graphics. After the drawings I need to print the
metafile.
If I try to print the Metafile right away, nothing shows on the page, now,
If I do a Graphics.Dispose() and then print the Metafile, it works without
any problem.
My problem is that after printing the Metafile I still need to work on it
through the Graphics, but if I try to reinitializate the Graphics object with
a call of Graphics.FromImage(metafile), I get a "out of memory" error.
Is there a different way to create a Graphics from a Metafile ?
Is it possible to have access to a Metafile which is attached to a Graphics,
without having to dispose the Graphics ?
Thanks for any help.
______
Marco Tag: .NET Windows Forms Security Tag: 137973
Compiling WF assemblies with /platform:x64
Hello,
I have a service application that uses Windows Workflow Foundation as part
of its processes. One of the class libraries in this application is a
collection of custom WF activities that I have written to represent the bits
of business process.
The solution compiles fine when compiling with the /platform:anycpu flag and
all is good, but when I try to compile the same solution with the
/platform:x64 the class library with the WF activities fail with a "error
348: Compilation failed." It goes on to say "Unable to load one or more of
the requested types." but that's all the help I get.
I'm trying to build the application in a 32 bits machine running Windows XP
SP2, but I will run it in a Windows Server 2003 64 bits.
On the destination machine I have installed the 64 bit version of the
Framework 3.5 and when looking in "C:\WINDOWS\Microsoft.NET\Framework64\v3.0"
I can see only two sub-folders: "Windows Communication Foundation" and "WPF",
whereas in the 32 bit version of the Framework 3.0 I can see a third folder
called "Windows Workflow Foundation". Does it have any relevance?
Any help is appreciated. Tag: .NET Windows Forms Security Tag: 137972
The installer was interrupted before [AppName] could be installed.
I have created a simple Web Application that just contains default.aspx and a
web.config. I have added a Web Setup project to this solution, it Built Fine
in VS2008. The installer works fine on windows Vista x64, but fails on the
Virtual Machines of XP and 2003 R2. The installer reads "The installer was
interrupted before [Setup name] could be installed. You need to restart the
installer to try again."
Both of the installer logs contain this:
MSI (c) (AC:48) ... Note: 1: 2262 2: Error 3: -2147287038
DEBUG: Error 2769: Custom Action WEBCA_EvaluateURLsNoFail did not close 2
MSIHANDLEs.
The installer has encountered an unexpected error installing this package.
This may indicate a problem with this package. The error code is 2769. The
arguments are: WEBCA_EvaluateURLsNoFail, 2,
Action ended 18:24:08: WEBCA_EvaluateURLsNoFail. Return value 1.
I have looked this up and the only offered solution is to run it as
administrator. I have tried running it under an Account in Administrators
and as the local Administrator and still got the same message.
Does anyone know what is going on here? Even if I create a sample project
within one of these VM, it still gives me the same error.
Log:
(too big for here)
http://robinsoft.no-ip.biz/dev/dotnet/errors/WebSetupProjectErrors.txt
Thanks Tag: .NET Windows Forms Security Tag: 137970
www.dotnetvideos.net just released 10 New Videos on Data Tutorials
Hi all, www.dotnetvideos.net released 10 new videos in the following
categories. every registered user of this site still gets a FREE
subscription to asp.netPRO magazine. There are over 120+ Free video
tutorials, all are under 10 mintues. chek them out!!
An Overview of Editing and Deleting Data in the DataList (7 Videos) at
http://www.dotnetvideos.net/OverviewofEditingDeletinginDList/tabid/127/Default.aspx
Performing Batch Updates (3 Videos) at
http://www.dotnetvideos.net/PerformingBatchUpdates/tabid/128/Default.aspx
---venkat Tag: .NET Windows Forms Security Tag: 137968
Need help diagnosing WCF timeout exception
Hello,
I have a Windows Service-hosted WCF service that occasionally throws an
timeout exception, or something that looks like one. The call chain looks
like this:
Client->WCF Service->COM Server->COM App
The exception seems to appear as the call to the service is completing.
Interestingly, these exceptions do not seem to affect the tasks the service
is performing at the time of the error. If the errors are ignored all
subsequent dependent actions are successful.
The exception message is:
The maximum retry count has been exceeded with no response from
the remote endpoint. The reliable session was faulted. This is
often an indication that the remote endpoint is no longer available.
The inner exception says:
The HTTP request to
'http://xpsp2client:8000/CubularityServies/CuIWfcService' has
exceeded the allotted timeout of 00:01:00. The time allotted to this
operation may have
been a portion of a longer timeout.
I also occasionally see an exception claiming that I've exceeded the
inactivityTimeout of 00:10:00.
OK. When I started seeing these I set all the timeout values I could find
to 00:20:00 and the behavior was not affected. I'm setting the following
timeouts in the .config file:
For <binding> :
receiveTimeout
sendTimeout
openTimeout
closeTimeout
For <reliableSession> :
inactivityTimeout
For <host> :
openTimeout
closeTimeout
I'm wondering if there are timeout settings that I'm missing. I don't have
any values less than 20min yet I get errors telling me I've exceeded
timeouts of 1 and 10 minutes. I've used Intellisense to poke around and try
to find properties that aren't obvious in the WCF Config Editor, but haven't
turned up anything.
Any suggestions?
Keith
P.S. I've turned on verbose logging for the service and am trying to
understand them. Some exceptions are shown in the logs but not enough
detail is given to pinpoint the source of these faliure. Tag: .NET Windows Forms Security Tag: 137965
appSettings and applicationSettings
hi,
What is the difference between appSettings and applicationSettings (in the
app.config) for a windows application project with multiple links to .dll
files.
Thanks
regards,
Andrew Tag: .NET Windows Forms Security Tag: 137962
CAS, WPF & plugin question
In my application I am able to load plugins, i.e. use reflection look in an
assembly for classes implementing a given interface and instantiate them.
I would like these plugins to run with restricted right.
Like they are not able to access the file system, etc....
How could I do that?
Also, from some prelimiary reading it seems I will have to run thess plugin
in different AppDomain, but these plugin need to create some WPF.Controls
I'm adding to my main form's visual tree hierachy.
Is it possible to do that? I mean add in the UITree a WPF.Control which is
from a different AppDomain?
(I foresee a dispatcher problem)
Any tip? (or maybe I don't need to run my plugin in a different AppDomain
after all?) Tag: .NET Windows Forms Security Tag: 137956
how to send a reference/addressof some procedure to a new thread?
So, I have a new thread creating something like:
dim myThread as new System.Threading.Thread(AddressOf myProcedure)
but, could I send an any kind of parameter instead of call to myProcedure???
I don't know did I made myself clear, but I would like to have something
like:
public sub StartThread(byref myProc as Object)
dim myThread as new System.Threading.Thread(AddressOf myProc)
mythread.Start
end sub Tag: .NET Windows Forms Security Tag: 137951
smtp DeliveryMethod
Any help with -
'=========== THIS PART IS NOT WORKING ========
section in the code.
I'm not able to send using emails using "C:\temp\" folder!
Any idea!
Thanks
-------------------------------------------------------------------------
Sub SendAsync()
Try
Dim strmsgBody As String = "hello world:
Dim item As String
'Listbox1 items
'email@hotmail.com
'email2@hotmail.com
'email3@hotmail.com and so on...
For Each item In ListBox1.Items
Dim mail As New Net.Mail.MailMessage()
Dim smtp2 As New Net.Mail.SmtpClient("hostname", "25")
Dim cred As New Net.NetworkCredential("username",
"password")
smtp2.Credentials = cred
mail.IsBodyHtml = False
Dim userState As Object = mail
AddHandler smtp2.SendCompleted, AddressOf
SmtpClient_OnCompleted
'=========== THIS PART IS NOT WORKING ========
smtp2.DeliveryMethod =
Net.Mail.SmtpDeliveryMethod.SpecifiedPickupDirectory
smtp2.PickupDirectoryLocation = "C:\temp\"
'=========== THIS PART IS NOT WORKING ========
smtp2.SendAsync("from@email.com", item.ToString, "Subject",
strmsgBody, userState)
smtp2 = Nothing
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Public Sub SmtpClient_OnCompleted(ByVal sender As Object, ByVal e As
System.ComponentModel.AsyncCompletedEventArgs)
Dim mail As Net.Mail.MailMessage = CType(e.UserState,
Net.Mail.MailMessage)
Dim subject As String = mail.Subject
If e.Cancelled Then
MessageBox.Show("Send canceled for mail with subject:", subject,
MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
If Not (e.Error Is Nothing) Then
MessageBox.Show("error")
Else
MessageBox.Show("msg sent")
End If
End Sub Tag: .NET Windows Forms Security Tag: 137950
Typed datasets and table table adapters components not showing in
Typed datasets and table table adapters components not showing in
Toolbox
Hi,
I have a solution with several projects. One project contains datasets
with table adapters.
When I opened a usercontrol in design mode, it used to have all
datasets and tableadapters in toolbox, under a tab name with the name
of the datasets project
However, I had to upgrate to a new hdd, and did a clean Windows
install, with VS2005, etc
Now, when I open te solution and open a usercontrol in designer, I see
only the other user controls, but no datasets or table adapters as I
used to have before. Sometimes I see a tab with the name of the
datasets project, but on it there is a text telling "There are no
usable controls in this group"
What happend?
I mention, on old HDD I had instaled VS2003 and VS2005, on new one I
have only VS2005 and installed VS2008 express, but then I removed it
(as I thought maybe it caused the issue). I even uninstalled and
reinstalled VS 2005, with no luck.
Can anyone help me with this?
Thank you Tag: .NET Windows Forms Security Tag: 137949
Tab and Ctrl+I in a richtextbox
Hello,
I program a user control which display a RichTextBox and a format
ToolStrip.
I want to process some shortcut keys.
The RichTextBox accepts tab.
Ctrl + I is supposed to format the selection in italic.
But Ctrl+I is also de code for Tab.
So when I press Ctrl+I, a tab is inserted (replacing the current
selection) AND the new selection is formatted in italic.
How can I do this ? Do I have to inherit first the standard RichTextBox
and override the OnKeyDown method ?
--
Fred
foleide@free.fr Tag: .NET Windows Forms Security Tag: 137942
Error 080080008
Please advise how do I solve this problem. I have tried to install the
actualizations without positive result. Tag: .NET Windows Forms Security Tag: 137936
Syntax Difference C#/VB.NET when calling a Method
Hi. I'm a VB.NET developer learning C#, and I have a simple syntax question.
In C# whenever you invoke a method you need to include the parentheses ()
after the method name even if there are no parameters. In VB.NET you don't
have to do this. For example -
IDataReader oReader;
while (oReader.Read) //This will throw an exception
while (oReader.Read()) //This is the correct way.
I'm just curious why C# requires this but VB.NET does not.
Thanks!
Mike Tag: .NET Windows Forms Security Tag: 137929
how to properly sink event or use AxHost.ConnectionPointCookie?
I got trouble from trying to sink event to a class itself.. I want the
inherited webbrowser to handle newwindow2 event and raise it to consuming
control
the crux of the problem is the statement ( for lack of understanding
getCtype and
AxHost.ConnectionPointCookie ):
cookie = New AxHost.ConnectionPointCookie(Me.ActiveXInstance, _
wevents, GetType(DWebBrowserEvents2)) <== error
Here are the high level details
the class is
...
public class extendedWebBrowser
inherits system.windows.forms.webbrowser
Private cookie As AxHost.ConnectionPointCookie
Private wevents As WebBrowserExtendedEvents
......
Protected Overrides Sub CreateSink()
MyBase.CreateSink()
wevents = New WebBrowserExtendedEvents(Me)
cookie = New AxHost.ConnectionPointCookie(Me.ActiveXInstance, _
wevents, GetType(DWebBrowserEvents2)) ' <<< oops error about
' not exposing IConnectionPointContainer
End Sub
....
end class
<ComImport(), _
Guid("34A715A0-6587-11D0-924A-0020AFC7AC4D"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch), _
TypeLibType(TypeLibTypeFlags.FHidden)> _
Public Interface DWebBrowserEvents2
......
End Interface
thank you for your time and expertise Tag: .NET Windows Forms Security Tag: 137928
WCF Service hosted in IIS
Hi All,
based on server2003,
What's the meaning of "BUILD">"Publish WEB SITE" in visual studio 2008 menu
when I create WCF service.
what's the difference between "BUILD WEB SITE" and "Publish WEB SITE"?
When I create the WCF service hosted in IIS, Do I need to publish?
Is it all I need that just make virtual directory on ths iis, and open the
website in the vs2008, coding and saving?
Please, advice me.
Thanks,
soworl Tag: .NET Windows Forms Security Tag: 137924
Updating a collection using a lambda
Hi -
I have a situation where I'd like to use a lambda, but I'm not sure how.
Basically, I have a collection of objects and I want to set a property on
each object that meets a condition.
Right now, I have this:
IEnumerable<VariableCode> codes =
variable.VariableCodeList.Where(c => c.Type == "MyCondition");
foreach (VariableCode code in codes)
{
code.IsShown = true;
}//foreach
I'm thinking that I can replace the foreach bit with a single lambda
expression. Can anyone help me with that syntax?
Thanks.
--
-Paul Prewett Tag: .NET Windows Forms Security Tag: 137920
web deployed assembly
I have a windows forms assembly that needs to be deployed via a webpage.
This bit of code must provide a fully automated printing solution; in that
it must accept a parameter containing a graphic image to print, and print it
without any interaction.
The issue I'm having is that it throws a security exception [Request for
permission of type: System.drawing.printing.printingpermission ... failed].
This bit of code seems to work just fine if I use the print dialogbox and
select the appropriate printer, and of course fails if I don't use the
dialogbox.
This seems to be a security issue, but I'm not sure where to look, or how to
fix it.
And, so as to head off a couple of other issues; I need to pass a parameter
to it from the HTML page, and it has to be served by Linux.
Thanks. Tag: .NET Windows Forms Security Tag: 137919
AccessViolationException with AutoCompleteStringCollection Update
Hi,
i have form with a text box that uses a AutoCompleteStringCollection for
auto completion.
Now if a new value (one not yet contained in the collection) is entered, the
new value should be added to the collection.
Sounds simple, but i often (not always) get a System.NullReferenceException:
with as Stack trace as follows:
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW
bei
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop
bei System.Windows.Forms.Application.Run
bei FwO.Entry.MainClass.Main
and with that my application crashes.
Does anyone have any idea of what might cause this error and how i can
prevent it?
Thanks for any info./suggestion!
Regards,
Frank Tag: .NET Windows Forms Security Tag: 137918
file io
Hi,
I've a requirement wherein I need to close an opened file programatically.
How can I acheive it/
Thanks
Vijaya Tag: .NET Windows Forms Security Tag: 137914
File IO
Hi,
I've a requirement wherein I need to close an opened file programatically.
How can I acheive it/
Thanks
Vijaya Tag: .NET Windows Forms Security Tag: 137913
is there difference between XP Pro and Server2003?
Hi,
my local machine is XP Pro.
when I built the WCF hosted in IIS, it works fine.
(create virtual directory on IIS and open that website and coding.. that's
it.)
but When I try to built the WCF hosted in IIS in server machine, it causes
error.
(create virtual directory on IIS and open that website and coding. same with
xp pro)
my server machine is Server2003.
After I publish this on the different location in server2003 IIS, it works
fine.
Do I have to publish the WCFservice?
Is there difference between XP Pro and Server2003?
When I publish this, I have to be very careful since they just clean that
folder automatically.
Thanks,
soworl Tag: .NET Windows Forms Security Tag: 137905
Does HttpListener have the same quirk as HttpWebRequest
Hi...
We've implemented a server process using HttpListener to get and process
certain requests, but we've been noticing some odd serialization that
reminded me of a quirk in the client code.
We recently discovered an odd behavior of HttpWebRequest in the client code
where mixing sync and async methods resulted in everything quietly being
sync. Specifically, we were using GetRequestStream() to send the data up
synchronously then calling BeginGetResponse() to wait for the answer async.
Well, it turned out that if you call a sync method first the async calls
magically turn into synchronized ones - a rather undocumented behavior.
Now we're seeing some similar quirks on the server side with HttpListener.
We use BeginGetContext() to listen for a request. Our callback calls
EndGetContext() to get the details and then immediately calls
BeginGetContext() again to wait for another request.
But then we read the request synchronously, post the work in a queue with
the associated response object and move on.
What we're seeing is that if the client sends several requests in a row, it
blasts right through them but the server doesn't acknowledge even reading the
2nd request until after the response to the first request is written to and
closed.
Does HttpListener have some implicit serialization behavior like
HttpWebRequest?
Thanks
Mark Tag: .NET Windows Forms Security Tag: 137904
Any CPU assemblies, Framework64, and Process Explorer
Hi...
We're building our assemblies Any CPU and just now trying to throw them up
on an x64 box. I was using Process Explorer to look at something else, and I
noticed something peculiar. All of our assemblies were in the Framework64
temporary assembly cache for the running process but Process Explorer had
flagged them all as being 32-bit code.
Is this a quirk of Process Explorer not having a mind-meld of the .Net
framework and understanding how the code is being executed, or is Process
Explorer right and it's running in 32-bit mode, despite where it's running
from?
Thanks
Mark Tag: .NET Windows Forms Security Tag: 137903
New Information on Error 1603 when installing .NET Framework all
I was having major issues with installing Visual Studio 2008 on my
computer. In particular the .NET 3.5 component required to run Visual
Studio 2008. I tried everything that was online from editing registry
settings, setting access permissions and all. I was able to install up
to .NET FW 2.0 but past that I kept getting error 1603. This error is
usually an access error telling the user that the target drive, folder
or file is unaccessible. I found when doing a verbose log with the
install the Microsoft IIS installation on my computer was corrupted
and I needed to reinstall IIS on my computer. The best fix for this
issue is
1st: Uninstall the IIS server off of the computer.
2nd: Run the .NET FW 3.5 Installer
3rd: Re-Install IIS from the Windows CD-ROM.
4th: I was then able to install Visual Studio 2008 on my computer
after fixing this.
I hope this helps everyone out and sheds some light on installing. Tag: .NET Windows Forms Security Tag: 137902
Free MySpace, Facebook, YouTube Proxies!
Free Proxy Website, Unlock MySpace, Facebook, and all other websites.
Secure, and hides IP address!
<a href=http://www.8bi.org>http://www.8bi.org</a><br>
<a href=http://www.7rz.org>http://www.7rz.org</a><br>
<a href=http://www.4pw.org>http://www.4pw.org</a><br>
<a href=http://www.9rt.org>http://www.9rt.org</a><br> Tag: .NET Windows Forms Security Tag: 137898
Call for speakers for DataServices World (June 24, New York City)
Call for Speakers Closes March 15
DataServices World
New York City (June 24, 2008)
The complexities of distributed processing and the importance of
middleware can elude even senior technical people, including enterprise
architects, IT managers, consultants and designers. Enterprise
developers embraced the separation of presentation, data services and
application logic. Internet computing, web services and service-oriented
architecture (SOA) continued a trend towards moving data access and data
integration logic into a separate data services layer.
The data services layer, databases and data access are the focus of
DataServices World. We're looking for technical presentations about
architecture and solutions for data access and data integration from
heterogeneous data sources including SQL tables, geo-coded data,
content management systems, enterprise resource planning (ERP) systems,
data warehouses, and web data. Topics of interest include:
· End-to-end performance optimization: (database, metadata, data
distribution, caching, query tuning, load balancing, protocols, data
services)
· Information as a service
· Data services development: architecture, tools, LINQ, ADO.NET
Entity Framework, Astoria
· Essential capabilities for effective, robust, secure data
services
If you're interested in speaking, you must submit a proposal by March
15, 2008.
Curriculum sketch and more information:
http://dataservicesworld.sys-con.com/general/papers0608.htm
======== Ken North ===========
www.KNComputing.com
www.WebServicesSummit.com
www.SQLSummit.com
www.GridSummit.com Tag: .NET Windows Forms Security Tag: 137894
403: Forbidden exception
Hi there,
I'm traying to consume a web service over an https:// connection (see
some threads before ;-) ), and I got it:
System.Net.WebException
The request failed with HTTP status 403: Forbidden.
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
...
Is this because I need to authenticate with username and password? Or is
because of som certificate-related issue?
In the first case (authentication), should I use the following?
Service proxy = new Service(); //new web service proxy instance;
string username = ConfigurationManager.AppSettings["Username"]; //read
username from the config file
string password = ConfigurationManager.AppSettings["Password"]; //read
password from the config file
System.Net.NetworkCredential credentials = new
System.Net.NetworkCredential(username, password);
proxy.Credentials = credentials;
Thanks in advance,
Giulio - Italia
--
OnAir: Emily Loizeau - "Sur la route"
http://www.giuliopetrucci.it Tag: .NET Windows Forms Security Tag: 137893
Passing a Generic as a Parameter
This seems like something that should be possible, but I am having
trouble setting up a function to accept a generic type as a parameter.
A basic function that shows what I am trying to do:
Public Class BaseRecord(Of T)
Protected _id As Integer
Public ReadOnly Property ID() As Integer
Get
Return _id
End Get
End Property
End Class
Public Class StringRecord
Inherits BaseRecord(Of String)
Private _value As String
Public ReadOnly Property Value() As String
Get
Return _value
End Get
End Property
End Class
Public Class Validation
Public Shared Function ValidateRecord(ByVal record As
BaseRecord(Of Object)) As Boolean
If record.ID < 0 Then
Return False
Else
Return True
End If
End Function
End Class
However, when I try to call the validation function like this:
Dim rec As New StringRecord()
Validation.ValidateRecord(rec)
I get an error stating "Value of type StringRecord cannot be converted
to BaseRecord(Of Object)"
I have tried making the function "Byval record as BaseRecord(Of T)"
but it states that "Type T is not defined"
Is there a way to pass this record as I am attempting or do I need to
completely rethink the way I am wanting to do validation?
Thank you,
Mike Tag: .NET Windows Forms Security Tag: 137877
Passing a Generic as a Parameter
This seems like something that should be possible, but I am having
trouble setting up a function to accept a generic type as a parameter.
A basic function that shows what I am trying to do:
Public Class BaseRecord(Of T)
Protected _id As Integer
Public ReadOnly Property ID() As Integer
Get
Return _id
End Get
End Property
End Class
Public Class StringRecord
Inherits BaseRecord(Of String)
Private _value As String
Public ReadOnly Property Value() As String
Get
Return _value
End Get
End Property
End Class
Public Class Validation
Public Shared Function ValidateRecord(ByVal record As
BaseRecord(Of Object)) As Boolean
If record.ID < 0 Then
Return False
Else
Return True
End If
End Function
End Class
However, when I try to call the validation function like this:
Dim rec As New StringRecord()
Validation.ValidateRecord(rec)
I get an error stating "Value of type StringRecord cannot be converted
to BaseRecord(Of Object)"
I have tried making the function "Byval record as BaseRecord(Of T)"
but it states that "Type T is not defined"
Is there a way to pass this record as I am attempting or do I need to
completely rethink the way I am wanting to do validation?
Thank you,
Mike Tag: .NET Windows Forms Security Tag: 137876
1.1 install and 3.0 uninstall
My computer runs Windows XP. I have a perpetual automatic update message for
an Express Install. It is trying to install .NET Framework 1.1 Service Pack
1. It fails, says simply it was unable to install, and then goes back into
the windows update queue. I have read on other posts to try and uninstall
from 3.0 downward and then reinstall from 1.1 forward. I am also unable to
uninstall 3.0. It says that a newer version is on my computer and I need to
remove from Add/Remove programs. The problem is I was trying to uninstall
FROM Add/Remove programs. I have also tried the 3.0 uninstaller on the
Microsoft website but it says "We did not find specified products to be
installed." Excuse me - didn't the download say "Uninstall?" HELP!!! I'm so
confused! Tag: .NET Windows Forms Security Tag: 137864
Socket connection was forcibly closed by the remote host
Hy everyone,
I have a little problem doing socket-programming.
I've made a console-application with a socket listening on a sertain port to
accept connections from other clients.
The only thing my application has to do is accept the incomming clients,
read the data and send it to a database.
Everything works fine, but now and then my socket server seems to
crash/hang.
When I check my error-handling I see that my application is throwing this
exception :
"An existing connection was forcibly closed by the remote host"
Restarting my application solves this problem.
I don't know the reason, nor how to solve it.
I've already surfed the internet al lot, but dit not come to an satisfying
answer.
Someone who can help me or who has experienced the same problem ?
Thanks,
Frederick R.
--------------------------------------------------------------------------------
Orion Electronic Solutions Rijselseweg 60, 8900 Ieper Tel: 0473 70 21 62
Fax: 057 36 46 31 E-mail: frederick@orionsolutions.be Website:
www.orionsolutions.be BTW : BE 0881 077 823 Tag: .NET Windows Forms Security Tag: 137852
WPF, how to autosize control?
I have Controle like this
<UserControl x:Class="OpticGraph.ObjectTip"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Rectangle Stroke="Black" RadiusX="17" RadiusY="17" Fill="Pink" />
<TextBlock Name="textBlock" Margin="10,10,10,10"
Text="ObjectName" />
</Grid>
</UserControl>
In Visual studio disigner when I changed text of TextBlock all of it
resized.
I want to place this control on Canvas, but after Initiolazint this
control and text in it I have NaN in Width and Height, and I can't
detect center of it and place it.
How I can detect it's sizes, or handle it, to place with correct sizes
on Canvas?
___________
best regards
Poly Tag: .NET Windows Forms Security Tag: 137851
Mass Email
Hi,
Is there a logic in .net to send 1000 emails per second or more ..? And Can
I use multiple servers to send mass emails at the same time using one
database. I know one server won't handle it :o(
Any help would be appreciated.
Thanks,
Sonu Tag: .NET Windows Forms Security Tag: 137846
Batch of Stored Procedures
In our .Net 2.0 web service we need to insert/update data records into
SQL Server 2005 that have been uploaded to us in XML documents. There
could be anywhere from one to literally thousands of records in each
uploaded transaction, and there are several dozen destination tables.
Since performance is critical for this particular app, we were
thinking of combining the stored procedure calls into configurable-
sized batches using CommandType.Text and multiple concatenated EXEC
statements, so we minimize database roundtrips as opposed to calling
each SP individually in its own SqlCommand.
Is this a good approach? One concern is that SQL Server would have to
compile each and every batch since they will all be different, and the
overhead involved in this could become significant. Is this really
something to worry about, or not? Wouldn't a few batch compiles per
transaction still be better than potentially thousands of roundtrips?
Are there other problems with this approach?
Of course we are planning to stress test to see how it actually
responds, but I just wanted to get some opinions first in case someone
has done this before and can give advice/recommendations/suggestions
before we get too far into it.
Thanks!
MJ Tag: .NET Windows Forms Security Tag: 137842
shared assembly in the GAC?
I have created a shared assembly(adoio.dll) I have set the parameter to
local copy = false, but when I run my installer, I still get a copy of this
dll in my directory. The intention was to have a single copy in the GAC so
if I wanted to update it, it would be done in a single place.
What am I missing?
Thanks
--
Arnie Tag: .NET Windows Forms Security Tag: 137827
y of baseline in millimeter
I need a method to write a string on a graphics pretty similar to DrawString
but instead of specifying the (x,y) of the upper left corner of the imaginary
rectangle that surrounds the string, I would like to specify the (x, y) of
the baseline of the first caracter.
Also, I use graph.PageUnit = GraphicsUnit.Millimeter, so, the (x,y) should
be in millimeter.
I tried to use some Font and FontFamily methods but couldn't figure out how
to convert design unit metric into millimeter.
Could someone help me ?
______
Marco Tag: .NET Windows Forms Security Tag: 137826
.NET framework availability stats
Can you point me to the statistics about how many computers have particular
version on .NET framework installed.
I need to decide what version of .NET we can use for the desktop application
so that we could minimize downloads of framework redists.
--
Regards
Yuri,
Deep Software Tag: .NET Windows Forms Security Tag: 137824
How do I install a custom windows forms permission set and code group
without the SDK configuration tool?