Jump to content
Xtreme .Net Talk

prowla2003

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by prowla2003

  1. the answer public string getWWWPort( string sPortType, string sWebSvcInstance) { string sw3Site = "IIS://localhost/" + sWebSvcInstance; //string sw3Schema = ""; string sTmp=""; string [] sTmpArray ; if (sPortType.ToUpper() == "SERVERBINDINGS" ) { sPortType = "ServerBindings"; } if (sPortType.ToUpper() == "SECUREBINDINGS" ) { sPortType = "SecureBindings"; } //DirectoryEntry iisWebSrv = new DirectoryEntry("IIS://localhost/W3SVC/4"); DirectoryEntry iisWebSrv = new DirectoryEntry(sw3Site); PropertyCollection iisWebSrvProperties = iisWebSrv.Properties; DirectoryEntry schema = new DirectoryEntry("IIS://localhost/schema/" + iisWebSrv.SchemaClassName); PropertyCollection schemaProperties = schema.Properties; foreach(string s in schemaProperties["OptionalProperties"]) { try { if( s == sPortType ) { sTmp = iisWebSrvProperties[s].Value.ToString(); sTmpArray = sTmp.Split(new Char [] {':'}); sTmp = sTmpArray[1]; } } catch(Exception ex) { Console.WriteLine(ex.Message); } } return sTmp; }
  2. eerrrrrrr thanks for all your help!!!!
  3. I'm using this code Dim oDE As System.DirectoryServices.DirectoryEntry Dim oDC As System.DirectoryServices.DirectoryEntries Dim sIISPath As String sIISPath = "IIS:\\localhost\W3SVC\1" oDE = New DirectoryServices.DirectoryEntry(sIISPath) oDC = oDE.Children and running it in in debug and using the Autos window to try and find a property somewhere that holds the port that the IIS service is running on and cant.. can someone help. please!!
  4. Hi, I'm still new to this so any help will be appreciated. I have a asp function that I want to copy over to aspx. the function finds the port that a particular web server instance is running on. this is the asp --------------------------------------------- function getServerBinding() dim objWebSite dim vData dim sReturn set objWebSite = GetObject("IIS://localhost/" & mid(Request.ServerVariables("INSTANCE_META_PATH"),5)) vData = objWebSite.ServerBindings if typename(vdata) = "Variant()" then sReturn = vData(0) else sReturn = vData end if getServerBinding = replace(mid(sReturn,instr(sReturn,":")+1),":","") end function -------------------------------------------- in aspx I get Cant create Activex component on the GetObject line ------------------------------------------------- Private Function getServerBinding() As String Dim objWebSite As Object Dim vData As Array Dim sReturn As String Dim sMetaPath As String Dim sObject As String sMetaPath = Request.ServerVariables("INSTANCE_META_PATH") sMetaPath = Mid(sMetaPath, 5) sObject = "IIS://localhost/" & sMetaPath objWebSite = GetObject(, sObject) 'vData = objWebSite.ServerBindings 'If TypeName(vData) = "Variant()" Then ' sReturn = vData(0) ' Else ' sReturn = vData 'End If getServerBinding = Replace(Mid(sReturn, InStr(sReturn, ":") + 1), ":", "") End Function -------------------------------------------------- I found this bit of code as an explanation for a similar problem but dont know how to use it in my case.. 'Dim typeShell As Type = Type.GetTypeFromProgID("Shell.Application") 'Dim objShell As Object = Activator.CreateInstance(typeShell) 'Dim o As Object = typeShell.InvokeMember("Windows", Reflection.BindingFlags.InvokeMethod, Nothing, objShell, Nothing) 'Dim obIe As Object 'For Each obIe In o 'obIe.GetType.InvokeMember("Quit", Reflection.BindingFlags.InvokeMethod, Nothing, obIe, Nothing) 'Next Thanks for any help...
  5. whats the definition of "small projects"!?!?
  6. ok so would you be suggesting not to use namespaces at all? or just a companyname namespace? the basic object model we got is about 10 classes each will inherit from DataManager.. i can see that it doesn't really help "the organisation" of the classes to split that up into namespaces and i cant see us having huge numbers of classes in the future does anyone think different - just trying to get other peoples ideas on how anyone else has put together solutions
  7. any ideas on this... i've got a web application and was thinking of having namespaces like... companyname.datamanager companyname.booking companyname.vehicle these would also be the class names or very similar to... there are a many examples with namespaces such as companyname.datatier.booking companyname.datatier.vehicle i dont see the point in this... maybe there is when you have bigger applications than we have... or if you ever intend to split the different tiers on to different machines.. which i dont ever see happening any data managing happens in the datamanager class/namespace do i really need to split the namespaces the "Microsoft" way?? are there any other good reasons or articles people know of on how to organise things?
  8. so to get this right... if i have an existing asp include file with the following code excerpt <% dim gStr gStr = "HELLO" function Hello() 'dosomething end function %> i cannot just use it in an aspx without taking out lines that instantiate variables ie gStr = "HELLO" (ps. thanx for all the replies)
  9. could anyone help me with a bit of code so that I can access a stored proc return value within .NET... thanks
  10. I'm trying to convert asp straight to aspx with minimal changes to the original asp file... the asp file has an include file... and the specific problem i have is when i compile the page i get "Compiler Error Message: BC30188: Declaration expected." on the line str = "HELLOEESDFA" which is inside the include file. can anyone offer an explanation?? <script language="VBScript" runat="server"> dim str str = "HELLOEESDFA" function HelloWorld(str) HelloWorld = "Hello " & str end function </script> <%@ Page Language="vb" AutoEventWireup="false" Codebehind="test4.aspx.vb" Inherits="test4"%> <!-- #include file="../serverscripts/test.asp" --> <HTML> <HEAD> <title>test4</title> <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0"> <meta name="CODE_LANGUAGE" content="Visual Basic 7.0"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body> <form id="Form1" method="post" runat="server"> </form> </body> </HTML>
×
×
  • Create New...