c# code is not working as it should

Not sure where this is breaking down, code is designed for backing up a USB to user’s home folder on the network drive. If the path is found, then a message "ok to backup" is displayed. I'm on the network and the path is valid however it always displays "Please connect to network or VPN". There is more to this code yet to be completed but I wanted to test this as I go trying to eliminate problems while building.

I'm still very new at this but having a blast!!!



======================================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net.NetworkInformation;
using System.IO;



namespace MyUSB_Backup
{
   

    public partial class Form1 : Form
    {
       

        public Form1()
        {
            InitializeComponent();          

        }

        private void Backup_button_Click(object sender, EventArgs e)

        {
            //Display message while checking access to home folder
            Resultlabel.Text = ("Checking for access to John Doe's home folder");
           

           //Short pause for message to be read
            DateTime Tthen = DateTime.Now;
            do
            {
                Application.DoEvents();
            } while (Tthen.AddSeconds(3) > DateTime.Now);
           
              //checking for network access
             string strFullPath = "@\\SERVERNAME\\HOME\\jdoe";
         
             if (Directory.Exists(strFullPath))
           
            {
           
                Resultlabel.Text = ("Ok to backup files");

              //  backup process will be placed here copying all files to users network folder

            }

            else
            {

                Resultlabel.Text = ("Please connect to network or VPN");
               // process to close application will go here
            }

        }


        }
    }
jlspencerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
quick try...

>>string strFullPath = "@\\SERVERNAME\\HOME\\jdoe";

should be as:

string strFullPath = @"\\SERVERNAME\\HOME\\jdoe";

?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Nadav SolomonCommented:
just a little bit more, i think that if you use the @ sign it should be:
string strFullPath = @"\\SERVERNAME\HOME\jdoe";

if you dont use it then you need the \ escape:
string strFullPath = "\\\\SERVERNAME\\HOME\\jdoe";
jlspencerAuthor Commented:
A misplaced quote.....Thank you Thank you Thank you. Now it works as intended and I can complete the final part.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.