Are there any good articles or resources available for resolving the external IP address of a router from an internal computer. I have a computer that is using 192.168.0.x and I want to know the external IP address of the router that is located on the same network. I have looked at the System.Net namespace, and it appears to have a very limited functionality for IP address querying, unless I'm missing something. Thanks in advance!
Chris Quick
Posts
-
Router External IP address resolution... -
Popup Form Class ProblemsI am creating an application that will create a notify window similar to outlook 2003 notify popup. I am making an asyncronous remoting call using system.thread that raises an event to show the form. However, the form shows up as a black box and then immediately disappears when the event is called. If I call the function through a menu item or button, it works fine. Here's the popup code:
Private Sub ATU\_RetrieveDone(ByVal e As AsyncUpdater.AsyncUpdaterEventArgs) Handles ATU.RetrieveDone Me.UpdateTimer.Enabled = False If e.Forums Is Nothing Then UpdateTopicListView(e.Results) ' Updates a list view and ' displays the popup. Else UpdateForumListView(e.Forums) End If Me.UpdateTimer.Enabled = True End Sub Private Sub UpdateTopicListView(ByVal Topics As ResultsCollection) For index As Integer = 0 To Topics.Count - 1 ... Next Dim Message As String Message = "{0} new topic updates have been retrieved from {1}" Me.ShowPopup(String.Format(Message, Topics.Count, ClientSettings.WebURL)) End Sub Private Sub ShowPopup(ByVal Message As String, Optional ByVal TimeOut As Integer = 0) Dim displaytime As Integer If TimeOut < 1000 Then displaytime = ClientSettings.PopupTime \* 1000 Else displaytime = TimeOut End If Dim PW As New PopupWindow PW.SetProperties(NewMessagePopup.Blend, Message, displaytime) PW.ShowPopup() End Sub
And here's routine that creates the popup using a seperate windows form.
Public Sub ShowPopup() Dim tbl As TaskBarLocation Dim workingArea As Rectangle Dim pt As Point pt = New Point pt.X = 0 : pt.Y = 0 workingArea = SystemInformation.WorkingArea tbl = GetTaskBarLocation() ' Gets an enumerator ' indicating the windows task bar ' location. Select Case tbl Case TaskBarLocation.Bottom pt.X = workingArea.Right - Me.Width pt.Y = workingArea.Bottom - Me.Height Case TaskBarLocation.Left pt.X = workingArea.Left pt.Y = workingArea.Bottom - Me.Height Case TaskBarLocation.Right pt.X = workingArea.Right - Me.Width
-
Problems Displaying FormsI've done some more research and it appears the problem is caused using timers. I've used both System.Timers.Timer and System.Windows.Forms.Timer and both give the same result, a black box that appears and then disappears. If I call the ShowPopup subroutine by clicking a button, it displays correctly. If the timer causes the form to be displayed, I get the black box. Here's the logic steps used: 1) Timer.Tick event occurs 2) Tick Handler creates a new AsyncUpdater and invokes the GetUpdate method 3) GetUpdate creates a new thread and begins the remoting call 4) Once GetUpdate has completed the remoting call, the event RetrieveDone is raised. 5) The main form handles the event causing a list view to update it's list of items. 6) The ShowPopup method is called to display the popup. Any help or ideas would be greatly appreciated. I can't understand why the manual invoking (pressing a button) works but the event handler doesn't. Thanks!
-
Problems Displaying FormsI am creating an application that will create a notify window similar to outlook 2003 notify popup. I am making an asyncronous remoting call using system.thread that raises an event to show the form. However, the form shows up as a black box and then immediately disappears when the event is called. If I call the function through a menu item or button, it works fine. Here's the popup code:
Private Sub ATU\_RetrieveDone(ByVal e As AsyncUpdater.AsyncUpdaterEventArgs) Handles ATU.RetrieveDone Me.UpdateTimer.Enabled = False If e.Forums Is Nothing Then UpdateTopicListView(e.Results) ' Updates a list view and ' displays the popup. Else UpdateForumListView(e.Forums) End If Me.UpdateTimer.Enabled = True End Sub Private Sub UpdateTopicListView(ByVal Topics As ResultsCollection) For index As Integer = 0 To Topics.Count - 1 ... Next Dim Message As String Message = "{0} new topic updates have been retrieved from {1}" Me.ShowPopup(String.Format(Message, Topics.Count, ClientSettings.WebURL)) End Sub Private Sub ShowPopup(ByVal Message As String, Optional ByVal TimeOut As Integer = 0) Dim displaytime As Integer If TimeOut < 1000 Then displaytime = ClientSettings.PopupTime \* 1000 Else displaytime = TimeOut End If Dim PW As New PopupWindow PW.SetProperties(NewMessagePopup.Blend, Message, displaytime) PW.ShowPopup() End Sub
And here's routine that creates the popup using a seperate windows form.
Public Sub ShowPopup() Dim tbl As TaskBarLocation Dim workingArea As Rectangle Dim pt As Point pt = New Point pt.X = 0 : pt.Y = 0 workingArea = SystemInformation.WorkingArea tbl = GetTaskBarLocation() ' Gets an enumerator ' indicating the windows task bar ' location. Select Case tbl Case TaskBarLocation.Bottom pt.X = workingArea.Right - Me.Width pt.Y = workingArea.Bottom - Me.Height Case TaskBarLocation.Left pt.X = workingArea.Left pt.Y = workingArea.Bottom - Me.Height Case TaskBarLocation.Right pt.X = workingArea.Right - Me.Width
-
Creating .NET Components accessibly by classic ASPThank's for the information. The problem I am having is exposing it to VBScript. Whenever I use the following command I get a non-descript error:
Set PageRender = Server.CreateObject("MC.PageRenderer")
Here is my code. I'm trying to keep it simple until I understand how to implement it.
<Guid("3BFA03FD-B85D-48de-A9E8-FAE266B2D809"), _
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface _PageRender
<DispId(1)> Function ChooseContent(ByVal CalWidth As Integer, ByVal CalHeight As Integer) As String
<DispId(2)> Function GetNews(ByVal Width As Integer, ByVal Heading As String, ByVal IsImage As Boolean) As String
<DispId(3)> Property Action() As String
<DispId(4)> Property SubCommand() As String
<DispId(5)> Property ID() As Integer
End Interface<Guid("385AA220-84CD-4e25-A736-E3356C33F4A8"), _
ClassInterface(ClassInterfaceType.None), _
ProgId("MinistryCraft.PageRenderer")> _
Public Class PageRenderer
Implements _PageRenderPublic Property Action() As String Implements \_PageRender.Action Get End Get Set(ByVal Value As String) End Set End Property Public Function ChooseContent(ByVal CalWidth As Integer, ByVal CalHeight As Integer) As String Implements \_PageRender.ChooseContent Return CalWidth & "W x " & CalHeight & "H" End Function Public Function GetNews(ByVal Width As Integer, ByVal Heading As String, ByVal IsImage As Boolean) As String Implements \_PageRender.GetNews End Function Public Property ID() As Integer Implements \_PageRender.ID Get End Get Set(ByVal Value As Integer) End Set End Property Public Property SubCommand() As String Implements \_PageRender.SubCommand Get End Get Set(ByVal Value As String) End Set End Property End Class
Do I need to register this assembly with the global cache?
-
Creating .NET Components accessibly by classic ASPI was wondering if anyone has some good resources on how to create a .NET component that is accessible by using VBScript and Classic ASP. I know this is possible according to some of the things I've read, but I can't seem to find and actual implementation guides. Any help is appreciated! Thanks!
-
Remoting problem in VB.netI have a program that I need to figure out what is going on. First, the code: Class ListItemServer ---
Imports System.Data
Imports system.Data.SqlClientPublic Class ListItemServer
Inherits MarshalByRefObject
Implements ILists
Private mSQL As SqlConnection
Private mDA As SqlDataAdapterPublic Sub New() mSQL = New SqlConnection(Config.GetConnectionString) mDA = New SqlDataAdapter End Sub
#Region " Affiliation Types "
Public Function GetAffiliations() As System.Data.DataSet &_
Implements ILists.GetAffiliations
Dim SelectCommand As New &_
SqlClient.SqlCommand("tff_GetAffiliations", mSQL)
mDA.SelectCommand = SelectCommand
mDA.SelectCommand.CommandType = CommandType.StoredProcedureDim Data As New DataSet("AffiliationTypes") mDA.Fill(Data) Return Data End Function Public Function UpdateAffiliations(ByVal Data As System.Data.DataSet) As DataSet &\_ Implements ILists.UpdateAffiliations Dim SelectCommand As New &\_ SqlClient.SqlCommand("tff\_GetAffiliations", mSQL) Dim InsertCommand As New &\_ SqlClient.SqlCommand("tff\_AddAffilation", mSQL) Dim UpdateCommand As New &\_ SqlClient.SqlCommand("tff\_UpdateAffiliation", mSQL) Dim DeleteCommand As New &\_ SqlClient.SqlCommand("tff\_DeleteAffiliation", mSQL) SelectCommand.CommandType = CommandType.StoredProcedure InsertCommand.CommandType = CommandType.StoredProcedure UpdateCommand.CommandType = CommandType.StoredProcedure DeleteCommand.CommandType = CommandType.StoredProcedure With mDA .SelectCommand = SelectCommand .InsertCommand = InsertCommand .UpdateCommand = UpdateCommand .DeleteCommand = DeleteCommand End With With InsertCommand.Parameters ' Parameters End With With UpdateCommand.Parameters .Add("@AffiliationTypeID", SqlDbType.Int, 4, "AffiliationTypeID") ' Parameters End With With DeleteCommand.Parameters .Add("@AffiliationTypeID", SqlDbType.Int, 4, "AffiliationTypeID") End With Try mDA.Update(Data) Catch sqlex As SqlException Console.WriteLine(sqlex.Message) Catch ex As Exception Console.WriteLine(ex.Message) End Try
-
ASP ErrorCheck the permissions on the access .mdb file. If the iusr_machine account does not have write/modify access on the database, you cannot perform any updates. Also, because you have to modify these permissions, if possible move the access database outside of your IIS root folders.
-
.NET Registered COMI'm looking to create a COM component to run on my Web App. The Web App is server ASP pages and needs to access a COM component for retrieving items from a database. The reason I'm considering COM is because I would like to use DB Connection Pooling to interact with SQL server. I know there is a way to register a .net assembly as a COM component. My question is, I would like to know if I will be able to access the COM using VBScript. For example, can I use something like
Set PageRenderer = Server.CreateObject("MyCompany.PageRenderer")
and then call methods on it? Thanks for any input!
-
Problem while create subkey in registryI'm assuming that you are forgetting to turn the write ability on for the current key....
Dim myKey as RegistryKey = Registry.LocalMachine.OpenSubKey("Software",True
The boolean value must be set to true when opening a sub-key because the default is read-only. Hope this helps.
-
Detecting if user has logged on (windows service)?This is entirely possible. You will need to make use of the System.ServiceProcess.ServiceController class to interact with the service. Create an application that uses this class of the .NET Framework. You will want to place the application for this server in the startup folder. Hope this helps you get started.
-
icons in win32Make sure your icons are set to be embedded resources by going to the properties of each icon you wish to include. Then, you can access the icon by the namespace of the DLL using the constructor for the icon class.
Dim myIcon as Icon
myIcon = New Icon(GetType(Company.MyProgram),"MyIcon.ico")The full namespace for the icon is: Company.MyProgram.MyIcon.ico Build actions for embedded resources are documented in the MSDN Library http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconfileproperties.asp[^].
-
100%CPU devenv.exeMake sure dynamic help window is not being displayed. That might be what's causing the spike.
-
Q:Deployment Projects and Custom ActionsI am working on a deployment project that I would like to perform some specific actions during install. For example, I would like to project to start the installer for MSDE if MSDE is not currently installed on the users system. I would also like to run some SQL scripts to create the initial database. I've read about using Module files to do this, but there seems to be a void of information on how to do some of these tasks. Also, I would like to capture the users request to install these items. For example, if they would like to install MSDE on the current workstation, they check a checkbox to install it (but only if it is not currently installed). I would like to do all of this using the deployment projects that come with Visual Studio. I know there are other installers that can do these things, and possibly much more easily. However, cost is driving the need. I'm just looking for resources, so if you have some it would be very much appreciated! Thanks!
-
Buttons not working...I performed a windows update to my server and now buttons that were once working are no longer working. Are there any known issues with an update? This occurs in two seperate applications that reside on the same server. Another server that has not had the patches applied works fine. Any ideas? Thanks
-
Problems with Button Controls after Windows UpdateI went back and checked other applications and I found the same problem. It just seems to be a server button control that handles a click event.
-
Problems with Button Controls after Windows UpdateHello all, I have an application that worked beautifully until the server had the latest windows' updates applied. Were there any changes that might keep a button control from working properly? I have a Windows XP system that runs the same application without any problems. However, my windows 2000 server will not process a click event on a server button control. Thanks! Chris
-
VB.NET RemotingI have been searching for simple examples of how to do remoting with VB.NET. What I desire is a remoting object that exposes some shared functions to return other objects. I am currently using console applications as my test environment. Here is my object that should be created by the shared function and returned to the client.
<Serializable()> _ Public Class SampleObject Private mName Private mData Public Sub New() Console.WriteLine("Object Created") End Sub Public Property Name() As String Get Return mName End Get Set(ByVal Value As String) mName = Value End Set End Property Public Property Data() As String Get Return mData End Get Set(ByVal Value As String) mData = Value End Set End Property Public Overrides Function ToString() As String Return mName & " " & mData End Function End Class
Now, my server has a class that will populate the object:
Public Class Creator Inherits MarshalByRefObject Public Shared Function CreateSampleObject() As RemotingObject.SampleObject Dim NewObj As New RemotingObject.SampleObject NewObj.Name = "Hello" NewObj.Data = "World" Return NewObj End Function End Class
The problem is that I do not understand where the Creator needs to be. Does a reference need to exist in both the client and server? If not, how do I activate a class of the object. Here is my server console application:
Imports System.Runtime.Remoting Imports System.Runtime.Remoting.Channels Imports System.Runtime.Remoting.Channels.Tcp Module Server Sub Main() RemotingConfiguration.ApplicationName = "Server" RemotingConfiguration.RegisterWellKnownServiceType( _ GetType(Creator), "object.rem", _ WellKnownObjectMode.SingleCall) Dim mChannel As New TcpChannel(1441) ChannelServices.RegisterChannel(mChannel) mChannel.StartListening(Nothing) Console.WriteLine("Listening on port: 1441") Console.ReadLine() mChannel.StopListening(Nothing) End Sub End Module
Finally, the client (as it stands right now -- and it doesn't work)
Imports System.Runtime.Remoting Imports System.Runtime.Remoting.Channels Imp
-
Converting UTC time to StringI am attempting to convert a UTC time into a normal date and time using a dataset and the dataset's .GetXML() method. I currently have the following UTC Time: 2004-08-16T16:30:54.0000000-05:00 I would like it to display as: 8/16/2004 4:30:54 PM This is so that when I create an Excel file through XSLT, I can set the column type to Date and then have a date that is User Friendly. Thanks for any help that can be provided.
-
DataGrid to ExcelIf your user has Excel XP or 2003, you have the ability to generate an Excel file through XML and XSLT. If you are binding to a dataset for your datagrid, getting the XML would be rather easy
strXML = DataSet1.GetXML()
Then you will need to read up on XSLT[^] and XPATH[^]. You will also want to read up on the XSD for Excel[^]. Hope this helps!