Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

tcombs07

@tcombs07
About
Posts
16
Topics
10
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Execute code at exact time
    T tcombs07

    Hey guys I am hoping someone can help. What I want to do is send an e-mail at 7:00 AM once a day. I know how to send an e-mail, and i thought i could do this using either a timer or a thread. This is also going to be a windows service in case that makes a difference. Thanks, Travis Combs

    C#

  • Confused out of my minde
    T tcombs07

    Just wanted to add, Thanks in advance to anyone who may have suggestions Travis Combs

    ASP.NET

  • Confused out of my minde
    T tcombs07

    Hey guys i am hoping you guys can help, i have been working on this project with i thought would be very simple, but anyways here is what i got. I have a listbox, text box, add and remove buttons. I type in the text box click add and then the item adds to the list box and then gets save to a text file, what i can't figure out is how to remove the items from the list box. i have done this several times in a windows application but i can't seem to get it to work in a asp.net web app. When i comment out the page load procedure i am then able to remove items from the list box. here is the code that i have:

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.IO;

    namespace WMS_WebConfig
    {
    public partial class _Default : System.Web.UI.Page
    {
    private StreamWriter writer;
    private StreamReader reader;
    int index;

        protected void Page\_Load(object sender, EventArgs e)
        {
            
            monitoredSitesLB.Items.Clear();
            
    
            if (!Directory.Exists("C:\\\\Program Files\\\\Virasec, LLC\\\\WMS"))
            {
                // Create the directory it does not exist.
                Directory.CreateDirectory("C:\\\\Program Files\\\\Virasec, LLC\\\\WMS");
            }
    
            if (!File.Exists("C:\\\\Program Files\\\\Virasec, LLC\\\\WMS\\\\monitoredsites.txt"))
            {
                writer = new StreamWriter("C:\\\\Program Files\\\\Virasec, LLC\\\\WMS\\\\monitoredsites.txt", true);
                writer.Close();
            }
    
            reader = new StreamReader("C:\\\\Program Files\\\\Virasec, LLC\\\\WMS\\\\monitoredsites.txt");
            string line;
    
            while ((line = reader.ReadLine()) != null)
            {
               monitoredSitesLB.Items.Add(line);
            }
    
            index = monitoredSitesLB.SelectedIndex;
    
           reader.Close();
            
        }
    
        protected void addBtn\_Click(object sender, EventArgs e)
        {
            ListItem item = new ListItem(urlTxtBox.Text);
    
            if (monitoredSitesLB.Items.Contains(item))
            {
                statusLbl.Text = "The website you entered is currently being monitored. " +
                    "Please enter another site to monitor.";
            }
            else
    
    ASP.NET

  • How to make a phone call?
    T tcombs07

    I would be very interested in getting that dll you have to do this? would that be at all possible? Thanks, Travis

    C#

  • How to make a phone call?
    T tcombs07

    Hey guys, I am writing a windows c# services that monitors servers and determines if the server is up or down based on whether or not it checks in. If one of the servers doesn't check in, the service needs to place a call to the tech on duty. What would I need to use to make a call in c#? Thanks in advance, Travis

    C#

  • System.NullException Error
    T tcombs07

    I appreciate your help, I added the code to check for null values. Another question I am hoping maybe you can help with is, I added debug code to help me sort out any further issues and I noticed that the line that says: rdr = cmd.ExecuteReader(); fails to execute, it drops immediatley into the catch block, do you have any ideas why that may be happening. Thanks, Travis

    C#

  • System.NullException Error
    T tcombs07

    Hey guys, I have this really weird issues and I can't seem to figure it out, the code list below run fine with no errors what so ever when I run it from a GUI application, but when i put it into a service and use it, it gives me a System.NullException error, but what is weird is that it gives me that error in the Finally Statement, but for some reason it doesn't even bother writing to the registry like it is suppose to, but it keep in mind the exact same code works if it is in a GUI application. I have labeled the two lines that the error is given at. Thanks for those who help. Travis using System; using System.Collections.Generic; using System.Text; using System.Data.SqlClient; using System.Data; using Microsoft.Win32; class VCS { private RegistryKey regKey; private SqlDataReader rdr = null; private SqlCommand cmd = null; private string procValue; private string connString private SqlConnection virasecConn = new SqlConnection(); public void executeStorProc(string procedureName) { try { openConn(); cmd = new SqlCommand(procedureName, virasecConn); cmd.CommandType = CommandType.StoredProcedure; rdr = cmd.ExecuteReader(); while (rdr.Read()) { regKey = Registry.LocalMachine.OpenSubKey ("SOFTWARE\\VIRASEC, LLC\\VCS", true); procValue = rdr[0].ToString(); regKey.SetValue("Test", procValue); } } catch (Exception ex) { Console.WriteLine(ex.Source + "\n" + ex.StackTrace); } finally { **regKey.Close(); - Error occurs here rdr.Close(); - Error occurs here** closeConn(); } } public void openConn() { virasecConn.ConnectionString = connString; try { virasecConn.Open(); } catch (Exception ex) { Console.WriteLine(ex.Source + "\n" + ex.StackTrace); } } public void closeConn() { try { virasecConn.Close(); } catch (Exception ex) {

    C#

  • Using C# to get web page information
    T tcombs07

    Hey guys I am hoping you can help with this. I am writting a windows service that monitors servers and reports back to an asp page which collects the data and displays it in a grid which notifies us if a server is up or down. Recently we started writting an asp page that holds certain configuration data, one being the web url(which is used for check in). And my question for you guys is how do I tell my service to check that asp page every so often to see if the web url has changed, and if it has changed pull the new url and use that for the check in. I hope that made sense. I look forward to hearing what you guys have to say. And thanks in adavance to everyone that helps Travis

    C#

  • Service deployment question?
    T tcombs07

    Hey guys, I have been creat a service and it is just about finished all i need to do now is creat the deployment project and the question that i have is this. Is there any way to have the service start automatically right after the the install is finished? I know there are custom actions that I am sure can do this but I dont know how to get that to work. Please help and thanks again in advance. Travis Combs

    Visual Basic

  • How to create a custom deployment project?
    T tcombs07

    Hey guys, I need a little help and i am hoping you guys can do the trick. What i need to do is this. I need to create a delployment project that installs a service which I can do, but during the install of the service I need the user to be prompted to enter a server ID and then have that get changed in my source code, so the service knows which server to talk to after it is installed. I am thinking it is pretty easy to do, but I am uncertain how to do it. Please help!! Thanks, Travis

    Visual Basic

  • Need help with my service please!!!
    T tcombs07

    Hey guys the problem that I am is this. I am writting a service that every five minutes goes out and requests a web page. And the problem that I am having is whenever I disconnect my computer for the internet, the service throws an error. I have tried implementing some error handling but I can't seem to figure it out. I would like to code somethingso that if in 30 seconds a response is not gathered then to abort the request and try again in five minutes. Here is the code that i currently have: Imports System Imports System.IO Imports System.Net Imports System.Threading Public Class VirasecHB 'Declare the Thread Private VirasecHB_Thread As New Thread( _ New System.Threading.ThreadStart(AddressOf waitProcedure)) 'Declare Variables Dim serverID As String = "1336" Dim webURL As String = "http://www.virasec.com/intranet/tech/heart/heartdb.asp?hdur=300&hsid=" & serverID Protected Overrides Sub OnStart(ByVal args() As String) ' Add code here to start your service. This method should set things ' in motion so your service can do its work. WebRequestProcedure() VirasecHB_Thread.Start() End Sub Protected Overrides Sub OnStop() ' Add code here to perform any tear-down necessary to stop your service. VirasecHB_Thread.Abort() End Sub Private Sub WebRequestProcedure() ' Create a request for the URL. Dim request As WebRequest = WebRequest.Create(webURL) ' If required by the server, set the credentials. request.Credentials = CredentialCache.DefaultCredentials 'Sets web request timeout time request.Timeout = 30000 ' 30000 = 30 Seconds ' Get the response. Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse) 'Close the response request response.Close() End Sub Private Sub waitProcedure() Do 'Wait Five Mintues System.Threading.Thread.Sleep(300000) '300000 = 5 Minutes Try WebRequestProcedure() Catch ex As Exception Dim errorLog As New EventLog errorLog.WriteEntry("Virasec Heartbeat Service " & _ "has encountered an error while trying to " & _ "connect to the Virasec web server. " & _ "The service will attempt to " & _ "connect again in five minut

    Visual Basic

  • Please Help!! Please
    T tcombs07

    Hey man, I just wanted to say thanks alot for that little bit of information. By using the webrequest I got the results I was needing. Thanks again, Travis

    Visual Basic

  • Please Help!! Please
    T tcombs07

    Hey Guys, this I need to do hopefully you guys can help. I just need an application or service to browse to a certain page every five minutes. In my case it will be an asp page. Once the services browses to the page it just needs to close the and the asp page takes it from there and starts producing a grid. For instance when it connects properly the grid will show some green, but say the service gets stopped or the computer or server goes down then the grid will start showing red. I hope that all made sense, if not just let me know and i will try to give some more info. I am just hoping someone can help. Thanks, Travis

    Visual Basic

  • VB.Net Service Question
    T tcombs07

    Thanks everyone for all the information, but even with all that there is still nothing. Let me see if I can elaborate on what I am trying to do and maybe you guys have a better way of doing it and it can solve my problem. I just need an application or service to browse to a certain page every five minutes. In my case it will be an asp page. Once the services browses to the page it just needs to close the and the asp page takes it from there and starts producing a grid. For instance when it connects properly the grid will show some green, but say the service gets stopped or the computer or server goes down then the grid will start showing red. I hope that all made sense, if not just let me know and i will try to give some more info. I am just hoping someone can help. Thanks, Travis

    Visual Basic

  • VB.Net Service Question
    T tcombs07

    Thanks, Here is the error message ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment. and that is happening when the service tries to execute the webbrowser1.navigate("url")

    Visual Basic

  • VB.Net Service Question
    T tcombs07

    Hey guys, I have a quick question that I am hoping someone can answer for me. What I am trying to do is create VB.Net service that navigates to a page in the background every five minutes. What i am trying now is that i am using the Web Browser Control and in my start code i am using WebBrowser1.Navigate("URL Addres"), but once i go to install and run the service it gives me a Thread Exception error. Does anyone know the answer, please help because I have tried several things and none of which have worked. Thanks, Travis

    Visual Basic
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups