﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » How to discover network address of server from within app</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Thu, 09 Apr 2026 03:05:05 GMT</lastBuildDate><ttl>20</ttl><item><title>How to discover network address of server from within app</title><link>http://forum.strataframe.net/FindPost29413.aspx</link><description>Mind going blank -&lt;br/&gt;&lt;br/&gt;&lt;div&gt;what is the syntax to discover the network address of the box with the &amp;nbsp;sql server my app is connected to?&lt;br/&gt;&lt;br/&gt;&lt;div&gt;for some reason I'm drawing a blank on how to reference the application connection ... ???&amp;nbsp;&lt;br/&gt;&lt;br/&gt;&lt;div&gt;I want to direct temp files for a process to the same box as the sql server ( I'm deserializing and manipulating stored pdfs ) to cut down on WAN traffic on a VPN.</description><pubDate>Fri, 21 Jan 2011 09:43:33 GMT</pubDate><dc:creator>Charles R Hankey</dc:creator></item><item><title>RE: How to discover network address of server from within app</title><link>http://forum.strataframe.net/FindPost29424.aspx</link><description>&lt;span id="ctl00_ctlContentPlaceHolder_ctl00_ctlTopic_ctlPanelBar_ctlTopicsRepeater_ctl03_lblFullMessage"&gt;&lt;span&gt;[quote]&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ctlContentPlaceHolder_ctl00_ctlTopic_ctlPanelBar_ctlTopicsRepeater_ctl03_lblFullMessage"&gt;And good luck with Rob Ryan&lt;span&gt;[/quote]&lt;br/&gt;&lt;br/&gt;Yeah...you passed him off to us.&amp;nbsp; But if you look at the stats, he did improve your defense a lot.&amp;nbsp; If they keep Colt McCoy in as starter this next year, I think that you may finally have a quarterback!&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;</description><pubDate>Fri, 21 Jan 2011 09:43:33 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How to discover network address of server from within app</title><link>http://forum.strataframe.net/FindPost29421.aspx</link><description>Hi Charles.&lt;br/&gt;&lt;br/&gt;Expanding a bit from what Trent gave you:&lt;br/&gt;&lt;br/&gt;[codesnippet]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- estabilish locals&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim connString As String&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim serverName As String&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim parseConnString As New Data.SqlClient.SqlConnectionStringBuilder&lt;br/&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- get the active connection string&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; connString = ConnectionManager.GetApplicationActiveConnectionString("MyApplicationKey", "")&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- set the parser connection string&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parseConnString.ConnectionString = connString&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- get the server name from the parser&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; serverName = parseConnString.DataSource&lt;br/&gt;[/codesnippet]</description><pubDate>Fri, 21 Jan 2011 09:02:01 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: How to discover network address of server from within app</title><link>http://forum.strataframe.net/FindPost29420.aspx</link><description>[quote][b]Charles R Hankey (1/21/2011)[/b][hr]...I have control of the server box so I can precreate the server folders and their permissions.&amp;nbsp; Just wanted to learn the trick of discovering the server box's name so I didn't have to rely on making it an app setting ( If I did that I was considering pulling it when the connectionmanager first found the database after installation ) [/quote]&lt;br/&gt;Hi Charles,&lt;br/&gt;Even though you may have control of the network for this application, I would use this server location in a configuration table instead so you can simply choose the location and use it everywhere you need it in your application.&lt;br/&gt;&lt;br/&gt;Relying on finding networking shares could be tricky and if for whatever reason in the future the network configuration changes (ex: Server crash, etc) then your application could end up broken.</description><pubDate>Fri, 21 Jan 2011 08:58:29 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How to discover network address of server from within app</title><link>http://forum.strataframe.net/FindPost29419.aspx</link><description>Thanks very much, Trent.&amp;nbsp; This should get me going.&amp;nbsp; I have control of the server box so I can precreate the server folders and their permissions.&amp;nbsp; Just wanted to learn the trick of discovering the server box's name so I didn't have to rely on making it an app setting ( If I did that I was considering pulling it when the connectionmanager first found the database after installation ) &lt;br/&gt;&lt;br/&gt;Good to know DDT is supporting Filestream as I'm also considering that for some other stuff.&lt;br/&gt;&lt;br/&gt;And good luck with Rob Ryan &lt;span&gt;:)&lt;/span&gt;</description><pubDate>Fri, 21 Jan 2011 08:45:11 GMT</pubDate><dc:creator>Charles R Hankey</dc:creator></item><item><title>RE: How to discover network address of server from within app</title><link>http://forum.strataframe.net/FindPost29417.aspx</link><description>Well, this would depend on how you are trying to accomplish this.&amp;nbsp; You can get the machine name / IP address out of the connection string from the data source, but this won't give you the share of that machine.&amp;nbsp; If you just have a machine name, you can use the &lt;br/&gt;&lt;br/&gt;&lt;span&gt;[codesnippet]Dns.Resolve("MachineName")[/codesnippet]&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;to get the IP of the machine.&amp;nbsp; But if you have the machine name that too may be enough.&amp;nbsp; The second part of this is knowing the share of the machine.&amp;nbsp; Before we move on, another way to parse a connection string is to place it in an SqlConnectionStringBuild and you get get the machine part:&lt;br/&gt;&lt;br/&gt;&lt;span&gt;[codesnippet]System.Data.SqlClient.SqlConnectionStringBuilder sql = new SqlConnectionStringBuilder(MicroFour.StrataFrame.Data.DataBasics.DataSources[""].ConnectionString);[/codesnippet]&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;After you have the machine name, there are other obstacles before you can start writing files.&amp;nbsp; One thought may be to use the new FILESTREAM option in SQL Server 2008.&amp;nbsp; The DDT supports this now as well if you choose to go down this path.&amp;nbsp; This can be more complicated on deployment, but the files are stored externally from SQL but processed through SQL.&amp;nbsp; This way you can use Express and not eat into your database size while still going through your data process.</description><pubDate>Fri, 21 Jan 2011 07:48:20 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>