|
I think the following on an ASP.NET or its associated codebehind page should solve your problem:
string userip = Request.ServerVariables["REMOTE_ADDR"].ToString();
string workstationname = System.Net.Dns.Resolve(userip).HostName.ToString();
The name of the machine accessing the webserver should be contained in the workstationname. However the firewall might put its name over there.
We are currently using a proxy called 'Squid Cache' and I observed the following type of header contains the IP Address of the client machine (that is mine), which is behind the proxy/firewall.
HTTP_X_FORWARDED_FOR
But the name of the machine behind the proxy might need a workaround though.
Deepak Kumar Vasudevan
|
|
|
|
|
Hi everybody
Using the previous version of Visual Studio when we would have to create a platform that will expose interfaces to front-end systems we would use configured COM+ components that would implement the IDispatch. What about the .NET approach? What if our project has nothing to do with internet and thus a Web service is not considered necessary. What type of approach we will use in such a case?
Thanks
Spiros Prantalos
|
|
|
|
|
I'll let .NET gurus explain things.
In the mean time, from what I can tell in short is that you can create COM components using the .NET framework using whatever language supported by this framework. You register assemblies (the result of .NET project files compilation) with the external regasm commandline.
The only visible difference with native COM components is seen in the registry : your inproc or localserver32 key will not point to YOUR dll or exe, but to mscoree.dll instead (bootstrap which hosts the CLR). In other words, the .NET run-time is required whenever you create COM components using .NET
Other than doing COM, the capabilities of .NET assemblies are not compatible with COM itself, but provide the same set of features, and better versioning btw, so if you are doing true .NET code, you actually don't need COM any longer.
I would stick with VC++ (VC++.NET) for COM components : redistribution issues are known and it is far lighter (.NET 1.1 run-time is 24MB).
My -0.5 cent.
How low can you go ? (MS rant)
|
|
|
|
|
When you used the 'e-mail this person' link, you didn't fill in your e-mail address so I can't reply via e-mail.
To answer your question, yes; to use the controls like that the end-user must have the .NET framework installed. That technique also only works in IE.
James
Sig code stolen from David Wulff
|
|
|
|
|
Thanks very much for your response.
(In fact I just wanted to make a Reply and have made a 'e-mail this person' by error.)
|
|
|
|
|
Hi,
Is there any way how to insert class derived from Windows.Forms.UserControl (or Control ) to Web page ?
I am not talking about Asp.Net and i do not want to use it.
(Asp.Net is great but i need to react to users input very fast without downloading web page again)
I mean something like inserting (ActiveX conctol or Java applet) in the Web page.
(I do not need to install this from web - everybody who will enter this page can have installed .Net framework and anything else).
Thanks
/* I'm sorry about my english but i hope you can understand this */
|
|
|
|
|
Tomas Petricek wrote:
mean something like inserting (ActiveX conctol or Java applet) in the Web page.
I suppose you could either go with the Java applet or an ActiveX control (which I believe you would probably do in ATL). Does this help. Regardless of whether or not the end user has the .NET Framework or not, this is not required for a client if it is a web page that is being viewed. ActiveX controls download as plugins to the IE browser only. Hope this helps.
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
Yes it is possible, this code should do it (put it on your web page)
<object id="myCtl"
classid="http://www.mycode.Microsoft.com/mycode.dll#myClass"
</object> This requires that you create a class library and put the control named myClass in it. myCtl is a client side name so you can manipulate the control with script.
HTH,
James
Sig code stolen from David Wulff
|
|
|
|
|
Wow
This is exactly what i wanted
Than you
|
|
|
|
|
I like this!;P
But i have another little problem with this:
I don't know how to handle events of this control.
i know how to change properties of this using <param>:
<param name="Text" value="ButtonText">
or using JavaScript:
myCtl.Text='NewBtnTex';
But i do not know if i can handle events and (if it is possible) how to do it
Thank you
|
|
|
|
|
Google for "SimpleControl".
Then google for "Chris Sells", because he's written a few articles on this subject (MSDN and MSDN magazine) Also look at http://www.sellsbrothers.com/wahoo[^],
Make sure you know something about .Net code access security, permissions and codegroups, because you're gonna see security permission exceptions...
VictorV
|
|
|
|
|
When authoring custom controls it is possible to specify a custom (16x16) bitmap that will then be displayed for the control in the Toolbox. However, if you specify a file path (like @"C:\MyProject\resources\toolbox.bmp") it appears the VS.net looks for that file at the specified location at runtime rather than building the image into the control.
Obvioulsy after redistributing the control, the bitmap does not exist any more as they don't have the source code, or if they do they probably don't have it in the same location as the author.
How can I successfully specify a custom bitmap, but be able to redistribute the control?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
The easiest way to achieve this is to not bother using the ToolboxBitmap attribute and just include a bitmap in the project (at the same level) for each control named the same as the control class, i.e. MyControl.bmp for MyControl.cs.
Be sure to set the 'Build Action' to 'Embedded Resource' for the bitmaps.
Then the Toolbox will automatically use that image.
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hey Folks,
I initaly posted this in the C# group but realised that this may be more appropiate here.
I have a few old (very handy) programs that I have written using perl and python that I want to port to C# just for the sake of doing it.
In one of the instances, I need to enumorate across a directory and get the the total size of the files in the directory. Using a simple "foreach" loop like:
<br />
long total = 0;<br />
...<br />
...<br />
foreach(FileInfo f in directory.GetFiles())<br />
{<br />
total += f.Lenght;<br />
}<br />
...<br />
...<br />
And I have to say that this is SLOW. When recursing medium to large directories it can take as much as 10x the time my perl and python programs take.
My guess is that it is due to fact that the call to the Length property is not so light-weight as one might think. So, the call inside the loop is killing me.
Has anybody else ran into this hiccup?
And, does anybody have any suggestions about how to design around this?
Any help would be appreciated
Many Thanks
Chris
|
|
|
|
|
Hi Folks
Is there any library , class or assembley in .NET framework by which to obtain free disk space of a hard drive?
What do you think about: System.Management.Management object?
Please guide me.
thanks
arash
Arash Afifi
Software Engineer
E-mail: afifi@sympatico.ca
|
|
|
|
|
already answered[^].
How low can you go ? (MS retrofuck)
|
|
|
|
|
I have a form that binds controls to a dataset. Some of the fields in the dataset are date fields, so I am using DateTimePicker controls to display (and allow editing of) these fields.
However, the date field in question can be null. When this occurs navigation through the records in the dataset is stopped, that is setting the Position property on the BindingContext does not update the controls.
Is there a workaround that allows binding to null dates?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hi
How about modifying your dataset to insert a date as a default value, in case the field is NULL? Just a thought, mite work, mite not
Cheers
"There are no stupid question's, just stupid people."
|
|
|
|
|
Thanks for the idea, unfortunately a null date has meaning, so actually displaying a date would be confusing and misleading to the user.
Any other ideas?
I'm beginning to think I may have to do this myself. Any ideas what's involved in creating a data bound control?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hi again Derek
I just ran into a similar problem , but I have found a solution for binding a NULL value. Look at the following:
private byte rating;
[Bindable(true)]
public object Rating
{
get { return rating;}
set {
if (value == DBNull.Value) rating = 0;
else rating = (byte)value;
}
}
Hope this helps
"There are no stupid question's, just stupid people."
|
|
|
|
|
Q313513[^] might help. The code's in VB.NET, but it shouldn't be too hard to convert.
|
|
|
|
|
Better yet, here's some C# code that seems to work:
using System;
using System.Windows.Forms;
public class DateTimeBinding : Binding
{
public DateTimeBinding(string propertyName, object dataSource, string dataMember)
: base(propertyName, dataSource, dataMember)
{}
protected override void OnFormat(ConvertEventArgs e)
{
if (e.DesiredType == typeof(DateTime))
{
if (e.Value is DBNull)
e.Value = DateTimePicker.MinDateTime;
}
else if (e.DesiredType == typeof(bool))
{
if (e.Value is DBNull)
e.Value = false;
else
e.Value = true;
}
base.OnFormat(e);
}
protected override void OnParse(ConvertEventArgs e)
{
if (e.DesiredType == typeof(DateTime)
&& e.Value is DateTime
&& (DateTime)e.Value == DateTimePicker.MinDateTime)
e.Value = DBNull.Value;
else if (e.DesiredType == typeof(bool)
&& e.Value is bool
&& (bool)e.Value == false)
e.Value = DBNull.Value;
base.OnParse(e);
}
}
Then, you just need to add the appropriate bindings:
dtp.ShowCheckBox = true;
dtp.DataBindings.Add(new DateTimeBinding("Value", ds, "[Date Field]"));
dtp.DataBindings.Add(new DateTimeBinding("Checked", ds, "[Date Field]"));
I haven't tested updating the data, but the display seems to work fine.
|
|
|
|
|
Thanks, I'll take a look and let you know how I get on.
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Thanks very much (once again). I've had chance to try this out now and it certainly seems to work (though like you I haven't tested updating yet).
One thing that would make it a perfect (for me anyway) implementation was if the DateTimePicker.Text property could be set to "(null)" for null dates. Any ideas how to do that?
I tried setting this.Control.Text in the OnFormat override, but that caused the original problem to occur again Any ideas?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|