|
See the HttpWebRequest.CookieContainer property documentation in the .NET Framework SDK. Provide a CookieContainer to store cookies.
Also, a server does not search your cookie collection. That would be extremely dangerous (although there are security holes in implementations some times that allow servers to request a different cookie)! The browser sends cookies for the server and path relative to the request.
You'll have to devise a way to get the cookie and put it in the CookieContainer , though. The HttpWebRequest.Credentials property may help as well since you require authentication, those forms authentication makes implementations like this difficult.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Ok, I think I understand. I'll try to manage to build a right CookieContainer.
Thanks.;)
|
|
|
|
|
Hi everyone,
I'm trying to set the initial directory of the OpenFileDialog to the "My Documents" directory - is there a simple way to achieve this? Is there a system variable like %SYSTEMROOT% which allows you to set the initial directory to the windows install directory?
<br />
OpenFileDialog ofd = new OpenFileDialog();<br />
ofd.InitialDirectory = "%SYSTEMROOT%";<br />
I tried to google this and perhaps I'm using wrong keywords, but I didn't find anything
Thanks in advance,
Rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|
|
Environment.SystemDirectory
Mazy
No sig. available now.
|
|
|
|
|
I was looking for the path to the "My Documents" folder but thanks for pointing the Environment class out! I didn't even know that it exists, and Environment.GetFolderPath(Environment.SpecialFolder.Personal); does the job.
Thanks again!
rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|
|
i was meaking combinations of a,b,c.
how can i make all possible combinations.
this should show result like this.
aaa
aab
aba
bba
baa
acc
aca
cac
caa
cca
ccc
bbc
bcb
cbc
ccb
cbc
abc
i was thinking that i will be using
nested for loop with array
that will pick one by one charactors
and place it on the loop and make
all possible combinations.
Mazhar Hussain
|
|
|
|
|
Maybe I don't understand what you're saying. You want a program that prints out all of the possible combinations of "a", "b", and "c", right? It seems as though you already know the answer. It appears that you already know the answer but just to make sure, you're talking about doing something like the following, right?
<br />
string[] letters { "a", "b", "c" };<br />
<br />
foreach (string s1 in letters) {<br />
foreach (string s2 in letters) {<br />
foreach (string s3 in letters) {<br />
Console.Writeln(s1 + s2 + s3);<br />
}<br />
}<br />
}<br />
Stated without guarantee - express or implied - by an employee of Harbinger Software
|
|
|
|
|
|
:-DHello,
currently I am working on a mailapplication that checks my mail on different mailservers. Sometimes i want to view the contents of the message.
I am now currently using a Windows Form with a richtextbox. That richttextbox.Text is filled with a string which contains my message. Most messages are in HTML-format. So i get the HTML tags in the text. How do i prevent that? How can I convert that string to HTML and which component should I use to show the mail in stead of the richtextbox.
Regards,
Herman Talstra
homo sapiens non urinat in ventum
|
|
|
|
|
You should embed the WebBrowser control. That's what many of the HTML Email readers do, like Outlook, Outlook Express, and various other third-party email readers. Customize your Toolbox in VS.NET and find the Microsoft Web Browser Control (shdocvw.dll). Add that to your toolbox and drag it on your form. You can then use various methods to display the HTML content, such as saving it to a file and using WebBrowser.Navigate2 , or referencing the Microsoft.mshtml.dll assembly and either setting the HTML to the body.innerHtml , or use the UCOMIPersistFile class in the .NET base class library to cast the WebBrowser.Document to the interface and then use the Load method to load the HTML file that represents the body of your email message.
You can find many articles about using the WebBrowser control and even utilizing and implementing its designer interfaces to allow your program to type HTML email by using the following search: http://www.codeproject.com/info/search.asp?cats=3&cats=5&searchkw=webbrowser[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
I'm creating an application that uses the windows media encoder SDK.
I would like to show the properties/configuration pages of the input devices like wmenc.exe does.
This dialog is custom for every device installed but I'm sure that there is an standard way to show it.
Any idea/suggestion will be apreciated.
Thanks
|
|
|
|
|
There is no build-in support for this in the .NET base class library (BCL). This actually requires a lot of COM and native functions. Your best bet is to consult the Windows Driver Development Kit (DDK). Essentially, each device class has an associated CLSID for the property pages it supports. The client application creates a property sheet, adds-in default property pages for all devices, and queries the device class for additional property pages to include, similar to how shell property page extensions work, except in that case default property pages are added and the file's associated property sheet handlers are queried.
The Platform SDK does contain some information about this, but the DDK will provide much more specific information about device property sheets.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I am trying to bring up a directory in the Windows Explorer.
System.Diagnostics.Process.Start("Explorer.exe") brings up Windows Explorer just fine
System.Diagnostics.Process.Start("Explorer.exe", dirPath) brings up the directory in a regular window (with no folder tree on the left)
How do I get the directory to come up in Windows Explorer?
Thanks,
Elena
|
|
|
|
|
Process.Start("explorer.exe", string.Concat("/e,", dirPath); If you want the directory to be the root of the explorer window, use "/e,/root," instead of just "/e,". See http://support.microsoft.com/default.aspx?scid=kb;en-us;152457[^] for more information and options.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I have a big Problem:
I want to use a OCX in my C# Application.
To achive this I used the Project/Add Reference... menu and browsed for the Component in the COM Tab.
There are no problems on viewing the component in the Object Browser or to instance any class of the component. But if I try to call a method or set any property of any instanced class I get the following error:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information: Catastrophic failure
Does any one of you know, what that could be?
|
|
|
|
|
Could be many things. If you're not running the application on the same machine, make sure the target machine has the OCX and any of its dependencies installed (making sure that its dependencies are installed is required on the development machine as well). The threading model of the COM control might be a factory, too, but since the extension is OCX I'm guessing you used VB to create it and could never stomach getting deep enough into it many years ago to know if you can control the thread model.
To better assist you, could you perhaps post a short code snippet of how you're instantiating the control and calling the method?
Also, the object browser only views Type information. If you want to test the initialization of the control without factoring in your code (not saying that you did something wrong, but you must eliminate that possibility first), use the ActiveX Control Test Container, which should be in your tools menu. Add an instance of the control and try running a few methods on it to make sure that it's working correctly.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thank you for your answer!
The component is running on the same machine.
The threading model could really be a factory. A colleague created the component with C++/MFC. What could there be a problem?
I instance the class like:
MasDspMetadata.MasDspClass mMasDsp = new MasDspMetadata.MasDspClass();
mMasDsp.Connect (strHostname,dPort,dTimeout); //raises the error
With the ActiveX Control Test Container I have no problems on calling methods.
|
|
|
|
|
It doesn't really matter in what language a COM component was written, so long as the runtime for the language exists on the target machine, so it wouldn't be a problem if it was written in MFC (in fact, most components are written in C++, of which MFC is just a wrapper).
Take a look at tlbimp.exe in the .NET Framework SDK. It imports a typelib to an interop assembly (Runtime Callable Wrapper, or RCW). Perhaps by manually creating this assembly you can set some additional options. If this is an ActiveX control, you can also use aximp.exe to not only generate an RCW but also the source that would be compiled. I'm wondering if that string parameter (judging by your Hungarian notation) isn't being marshaled correctly. Remember that strings can be either ASCII or Unicode, and that Windows only natively supports ASCII (as opposed to Windows NT, which uses Unicode but can use ASCII). You can control how the string should be marshaled using the MarshalAsAttribute (see docs for details). If the MFC COM component only handles ASCII or Unicode, you should use UnmanagedType.LPStr or UnmanagedType.LPWStr respectively. If the guy built two COM components for Windows and Windows NT and they both support native strings, then you can use UnmanagedType.LPTStr .
The only other thing I can think of is the threading model (a factory merely creates components). Is this single-, apartment-, or free-threaded (or both latter models)?
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I tried to use tlbimp before and it took the same error.
I don't think that it is an error on marshalling because the same error is raised if I call a method with no arguments or if I want to set a property of the class.
Perhaps something on threading... Will try to get more information.
Thank you very much for your help!
|
|
|
|
|
http://support.microsoft.com/default.aspx?scid=kb;EN-US;146120
|
|
|
|
|
I want to use a dll without manually adding a reference in the solution explorer. Is there any way to do this ?? Something corresponding to the good old "import" maybe ???
|
|
|
|
|
An assembly cannot reference a Type if the assembly in which that Type is defined is not loaded. This is no different than any other platform. Even #import requires that a typelib exists on the machine (and running the code requires that the libraries containing the types defined in the typelib are present on the system).
Once an assembly that is required is referenced by your project, you can use using SomeNamespace; at the top of your source file, preventing you from having to type the namespace for a class each time, but the project still needs to have the assembly loaded that contains the definition for the Type you want to use.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I totally agree with you, but that´s not the point
The studio can create references to any registered component on the system. So I´m sure there is a way to do the same !?
|
|
|
|
|
What do you mean, "The studio can create references to any registered component on the system."? Your project needs to reference the assemblies required by your project, period. When you add components, the assemblies in which that component and its dependencies are defined are added automatically if they aren't added already, but only when you use the designer. If you manually type the code, it does not do this automatically. It's all because of the designer.
If you're talking about the assemblies that show up in the Add Reference dialog, you can add additional directories in which to search in the HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\Assembly folders key.
If you don't want to worry about where assemblies are located (even though VS.NET will copy assemblies to the application directory that aren't installed in the GAC), you can use gacutil.exe to add assemblies to the Global Assembly Cache (GAC), or drag-n-drop the assemblies into the %WINDIR%\assembly directory.
This is no different than any other language or platform, as I said before. In Java, the classes or JAR files have to be in the CLASSPATH when compiling or running the application (you can override the CLASSPATH on the command line, though). In Win32, libs must be linked in when compiling and the DLLs must either be in the application directory or in a directory in the PATH environment variable. In linux, the shared objects must be in a lib directory configured in the SO cache. With COM, a CLSID is used but that CLSID must be registered on the system, in which case the path to the file is specified in the registry, or a file can be referenced that is already in a PATH directory (though not recommended).
That's just how everything works. The only assembly that doesn't show up in the references is mscorlib.dll, which is implied by the compiler unless overridden (possible in the VS.NET 2003 C# project properties, or using the command-line compiler since .NET 1.0 (v1.0.3705)).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Ok, thank you for your detailed describtion !!
In my case it´s a com dll I want to load by manually typeing the code (that´s why I was talking about registered components). The reason is that I don´t want that people, using my code in their own projects, have to care about the references I need. I want to enable my code to collect everything it needs on it´s own.
|
|
|
|