|
Hi,
I was wondering if anyone has seen an example of how one can send an HTTPWebRequest, passing in a schema to define what information your sending and have an app, aspx? file retrieve process the request and send a response
Kind Regards,
Rik
|
|
|
|
|
You just need to upload the file via POST. If you look at the HttpWebRequest.GetRequestStream method documentation in the .NET Framework SDK, you'll find a nice example.
Note that this uses POST, though, not GET (which uses the query string). Sending a schema via GET is riddled with problems, one of which is size restrictions. A GET query string can only be so long (128 bytes, IIRC), and schemas can easily break that barrier.
In ASP.NET, there is an easy way to get files that are uploaded. See the HttpRequest.Files property documentation in the SDK. Use Page.Request to get the HttpRequest , then enumerate the Files property. Do what you need with the schema then send your response using the Page.Response property (an HttpResponse ).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Guys,
I'm trying to compile my C# class into DLL but unfortunately, the csc command is missing. "csc is not recognized as internal/external command." Is there any other way to compile it. I developed the class using VS .net under c#. Please if you could help me by directing me to sites that has the solution...
thanks in advance i'm a little bit in a hurry becuase of the deadline.
regards
/dabuskol
|
|
|
|
|
Why not just go and change the properties of the solution. Change the output type to class library in the output type of the general tab in common properties. Build your solution, go to your debug folder and collect your dll from there.
Tarakeshwar
CCIE Q(Routing and Switching), MCSE Security
|
|
|
|
|
Thank you very much.... I didn't know that. I will to incorporate my dll to my new solution.
regards
/dabuskol
|
|
|
|
|
If you're not using VS.NET, you either need to type the fully qualified path to csc.exe or add the directory it's in to your PATH environment variable (recommended so you don't need to type the path all the time). For .NET 1.0 and 1.1, the paths are listed below:- .NET 1.0: %WINDIR%\Microsoft.NET\Framework\v1.0.3705
- .NET 1.1: %WINDIR%\Microsoft.NET\Framework\v1.1.4322
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Health,
Thank you. I will try this when I do the recompilation. Anyhow, I tried to incorporate it in my new porject and it's working perfectly. I'm happy to say that this is my first class that is 100% my own ops in C#. he!he!he! "reusable codes"....
Regards
/dabuskol
PS: I'm new to c#
|
|
|
|
|
Hi,
1. I Designed MyEditor inherited UITypeEditor
public class MyEditor: System.Drawing.Design.UITypeEditor
{
private IWindowsFormsEditorService edSvc = null;
public override object EditValue(ITypeDescriptorContext context,
IServiceProvider provider, object value)
{
if (context != null&& context.Instance != null
&& provider != null)
{
edSvc = (IWindowsFormsEditorService)provider.GetService(typeof
(IWindowsFormsEditorService));
if (edSvc != null)
{
// Form Create
FormMyEditor dlg = new FormMyEditor((string) value);
if( edSvc.ShowDialog(dlg) == DialogResult.OK)
{
context.OnComponentChanged();
}
}
}
return value;
}
public override UITypeEditorEditStyle GetEditStyle
(ITypeDescriptorContext context)
{
if (context != null && context.Instance != null)
{
return UITypeEditorEditStyle.Modal;
}
return base.GetEditStyle(context);
}
}
2. Mapped MyEditor at Property
public class UserInfo
{
private string userName = string.Empty;
[Category("UserInfo"),DesignOnly(false)]
[Editor(typeof(MyEditor), typeof(UITypeEditor))]
public string UserName
{
get {return userName;}
set { userName = value; }
}
public UserInfo(){}
}
3.At RunTime, generally, MyEditor worked well at form application.
but, MyEditor did not work in other form application.
.NET called default string editor.
why .NET didn't call MyEditor in some case ?
thanks to regards!
|
|
|
|
|
How is your editor being invoked? Design-time components are required in order to work with the ComponentModel features of .NET. This doesn't mean they're limited to use at design-time (we use them in our runtime application), but the write objects must exist.
For example, the PropertyGrid provides design-time facilities even at runtime, using the ComponentModel. If you are trying to invoke your editor programmatically, you must also provide implementations of the ITypeDescriptorContext , IServiceProvider (that can return an instance of what services you need, like the IWindowsFormsEditorService ), etc.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I have code that subtracts two variables (type: double). The problem happends when both variables have the same value (should get 0)...
change = grandTotal - totalPayments;
but result is: 1.4210854715202E-14
(found that out with the MessageBox)
It's mucking up my if statement:
if (change > 0)
thanks,
Ron
|
|
|
|
|
doubles are not accurate they will often contain rounding errors.
You should used double.Epsilon to deal with it.
For example code to test equality should do something like this:
if (Math.Abs(testValueA - testValueB) <= double.Epsilon)
{
}
So your if statement could be something like:
if (change > double.Epsilon)
{
}
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
Thanks Colin,
I didn't realize that double would be so buggy.
Ron
|
|
|
|
|
myNameIsRon wrote:
I didn't realize that double would be so buggy
Its not buggy - That how double works. As the precision of floating point operations on processors increases the problem will decrease, but it will never go away completely.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
Are you working with money (I can guess it from the variables)? So why use Double if you could use Decimal type for money.
Just my 1 cent
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
Hi Serge,
Thanks, I thought that double would be sufficient...
but I guess not! Using decimal fixes the problem )
Ron
|
|
|
|
|
Hi Ron,
As far as I know, Decimal is the replacement for Currency data type that was in COM before, and it naturally fits in SQL Server's money datatype.
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
Dir sir
+. I'm using FAXCOMLib and C#.net for developing an application.
+. In my Application I have send a fax. But when I click button SendFax
I recevice an Error: "The handle is invalid"
What should I do ?
|
|
|
|
|
I was messing around with this code to hide my taskbar
ShowWindow(FindWindow("Shell_TrayWnd", NULL), SW_HIDE);
I think it's C or C++, but I really don't know... anyways to make it work in my C# app I just put in 0 , instead of SW_HIDE . I know SW_HIDE is in winuser.h and equals 0 , so thats why I put 0 ...
So, my question... I feel like i'm cheating "hard coding" a 0 . I would like to know how to use SW_HIDE and other things such as -- SW_SHOWNORMAL, SW_MAX etc. in winuser.h -- in my C# program the correct way.
/\ |_ E X E GG
|
|
|
|
|
They are usually just int variables , so you can do it like this:
private int SW_HIDE = 0;
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
yeah, that's what i'm doing right now...
/\ |_ E X E GG
|
|
|
|
|
You should actually declare them as const s. When it comes down to it, that's all they really are in C/C++ - constants. Since they're pre-proc definitions, they can't be changed by code. The value is actually inserted.
When you declare them as consts, the value is actually used as well. Those values will never change, and using consts is faster.
You can also use enums, which is another common way (but often requires casting to an int or something). The values of the enum are also used in place of a reference (they're value types).
That's just the way it is.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
t h a n k s
/\ |_ E X E GG
|
|
|
|
|
Since you cant use C++ .H files in C#, you have to recode the structures and constants you need from the header files into C# code. Just like Mazy showed you...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
like sorta make a class library out of them?
/\ |_ E X E GG
|
|
|
|
|
You could. Then in that library, you make the function declarations static so you don't have to instantiate the class in order to use the functions.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|