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
  1. Home
  2. General Programming
  3. XML / XSL
  4. C#/XML file naming problem

C#/XML file naming problem

Scheduled Pinned Locked Moved XML / XSL
csharpasp-netxmlhelpquestion
8 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eggie5
    wrote on last edited by
    #1

    Ok, so I have this app that you fill in your subject and then the message and then it formats it in the particular way i told it to, onto my webserver as a .xml file.... XmlTextWriter writer = new XmlTextWriter("poofacedjohn.xml", null); But, what I need is for the name of the xml file not to be poofacedjohn.xml, but rather the year, month, day, hour, and minute of the local machine... like..... 20030426_1718.xml 2003 04 26 17 18 |year||month||day|_|hour||minute| how would I acheive this...? I can do it in asp.net, but it's not working for me as just a regular windows app. /\ |_ E X E GG

    M Richard DeemingR 2 Replies Last reply
    0
    • E eggie5

      Ok, so I have this app that you fill in your subject and then the message and then it formats it in the particular way i told it to, onto my webserver as a .xml file.... XmlTextWriter writer = new XmlTextWriter("poofacedjohn.xml", null); But, what I need is for the name of the xml file not to be poofacedjohn.xml, but rather the year, month, day, hour, and minute of the local machine... like..... 20030426_1718.xml 2003 04 26 17 18 |year||month||day|_|hour||minute| how would I acheive this...? I can do it in asp.net, but it's not working for me as just a regular windows app. /\ |_ E X E GG

      M Offline
      M Offline
      Mark Smithson
      wrote on last edited by
      #2

      How are you trying do it, and what errors are you getting?

      E 1 Reply Last reply
      0
      • E eggie5

        Ok, so I have this app that you fill in your subject and then the message and then it formats it in the particular way i told it to, onto my webserver as a .xml file.... XmlTextWriter writer = new XmlTextWriter("poofacedjohn.xml", null); But, what I need is for the name of the xml file not to be poofacedjohn.xml, but rather the year, month, day, hour, and minute of the local machine... like..... 20030426_1718.xml 2003 04 26 17 18 |year||month||day|_|hour||minute| how would I acheive this...? I can do it in asp.net, but it's not working for me as just a regular windows app. /\ |_ E X E GG

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #3

        Try:

        string name = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml";
        XmlTextWriter writer = new XmlTextWriter(name, null);


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        E 3 Replies Last reply
        0
        • Richard DeemingR Richard Deeming

          Try:

          string name = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml";
          XmlTextWriter writer = new XmlTextWriter(name, null);


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          E Offline
          E Offline
          eggie5
          wrote on last edited by
          #4

          ok, i'll try it when I get home. /\ |_ E X E GG

          1 Reply Last reply
          0
          • M Mark Smithson

            How are you trying do it, and what errors are you getting?

            E Offline
            E Offline
            eggie5
            wrote on last edited by
            #5

            Im not getting an error, because I don't know how to do it.... that's my problem... any suggestions? /\ |_ E X E GG

            1 Reply Last reply
            0
            • Richard DeemingR Richard Deeming

              Try:

              string name = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml";
              XmlTextWriter writer = new XmlTextWriter(name, null);


              "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

              E Offline
              E Offline
              eggie5
              wrote on last edited by
              #6

              Wow, I can't believe I didn't think of that myselft... that's just what I needed, thanks dude. /\ |_ E X E GG

              1 Reply Last reply
              0
              • Richard DeemingR Richard Deeming

                Try:

                string name = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml";
                XmlTextWriter writer = new XmlTextWriter(name, null);


                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                E Offline
                E Offline
                eggie5
                wrote on last edited by
                #7

                Wait, one more thing... I have this programed saved in ... C:\Inetpub\wwwroot\WebLog\Entries\bin and it's working fine, but I need the .xml to be saved in.... C:\Inetpub\wwwroot\WebLog\Entries How can I change the following to save the .xml file in the \Entries folder? string fileName = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml"; XmlTextWriter writer = new XmlTextWriter(fileName, null); /\ |_ E X E GG

                E 1 Reply Last reply
                0
                • E eggie5

                  Wait, one more thing... I have this programed saved in ... C:\Inetpub\wwwroot\WebLog\Entries\bin and it's working fine, but I need the .xml to be saved in.... C:\Inetpub\wwwroot\WebLog\Entries How can I change the following to save the .xml file in the \Entries folder? string fileName = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml"; XmlTextWriter writer = new XmlTextWriter(fileName, null); /\ |_ E X E GG

                  E Offline
                  E Offline
                  eggie5
                  wrote on last edited by
                  #8

                  Wait, nevermind... I figured it out myself... string fileName = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml"; XmlTextWriter writer = new XmlTextWriter("C:/inetpub/wwwroot/weblog/entries/"+ fileName, null); /\ |_ E X E GG

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

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