file can be write on XP but can not on VISTA
-
i can write a file in the any drive of XP operating System but i can not on vista. plz see my code and suggest me how i can write on VISTA operating System. Server = txtServerHost.Text.Trim(); User = txtUserName.Text.Trim(); Password = txtPassword.Text.Trim(); DBName = "db_outlook"; DataTable dt = new DataTable("Server Configuration"); dt.Columns.Add("Server"); dt.Columns.Add("User"); dt.Columns.Add("Password"); dt.Columns.Add("DBName"); dt.Rows.Add(Server, User, Password, DBName); dt.WriteXml(Application.StartupPath + "\\ServerInformation.bin"); Thanks in advance
-
i can write a file in the any drive of XP operating System but i can not on vista. plz see my code and suggest me how i can write on VISTA operating System. Server = txtServerHost.Text.Trim(); User = txtUserName.Text.Trim(); Password = txtPassword.Text.Trim(); DBName = "db_outlook"; DataTable dt = new DataTable("Server Configuration"); dt.Columns.Add("Server"); dt.Columns.Add("User"); dt.Columns.Add("Password"); dt.Columns.Add("DBName"); dt.Rows.Add(Server, User, Password, DBName); dt.WriteXml(Application.StartupPath + "\\ServerInformation.bin"); Thanks in advance
-
If you launch your program from the Program Files folder I don't think you're allowed to write to that directory in Vista.
-
i can write a file in the any drive of XP operating System but i can not on vista. plz see my code and suggest me how i can write on VISTA operating System. Server = txtServerHost.Text.Trim(); User = txtUserName.Text.Trim(); Password = txtPassword.Text.Trim(); DBName = "db_outlook"; DataTable dt = new DataTable("Server Configuration"); dt.Columns.Add("Server"); dt.Columns.Add("User"); dt.Columns.Add("Password"); dt.Columns.Add("DBName"); dt.Rows.Add(Server, User, Password, DBName); dt.WriteXml(Application.StartupPath + "\\ServerInformation.bin"); Thanks in advance
What error message are you getting. By the way it is a REALLY bad idea to store passwords and usenames in plain text :)
CCC solved so far: 2 (including a Hard One!)
-
What error message are you getting. By the way it is a REALLY bad idea to store passwords and usenames in plain text :)
CCC solved so far: 2 (including a Hard One!)
-
thanks for ur reply. yes when i install the software it creates into program file. it creates in xp but not in VISTA. have any permission system? plz help me... thanks
I think Microsofts policy in Vista and 2008 Server is that you shouldn't write to the Program Files folder (except at install time). Simply choose another folder to store that file (for instance another predefined folder found in
Environment.SpecialFolder
). But as someone else wrote, do you really want to store a password in plain text like that? -
thanks for ur reply. yes when i install the software it creates into program file. it creates in xp but not in VISTA. have any permission system? plz help me... thanks
Don't store stuff in program files! There are two folders recommended for application storage depending on whether the data being stored is user specific.
// Environment.SpecialFolder.ApplicationData:
// The directory that serves as a common repository for application-specific data for the current roaming user.
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
// Environment.SpecialFolder.CommonApplicationData:
// The directory that serves as a common repository for application-specific data that is used by all users.
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);Dave
Generic BackgroundWorker - My latest article!
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus) -
I think Microsofts policy in Vista and 2008 Server is that you shouldn't write to the Program Files folder (except at install time). Simply choose another folder to store that file (for instance another predefined folder found in
Environment.SpecialFolder
). But as someone else wrote, do you really want to store a password in plain text like that? -
Don't store stuff in program files! There are two folders recommended for application storage depending on whether the data being stored is user specific.
// Environment.SpecialFolder.ApplicationData:
// The directory that serves as a common repository for application-specific data for the current roaming user.
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
// Environment.SpecialFolder.CommonApplicationData:
// The directory that serves as a common repository for application-specific data that is used by all users.
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);Dave
Generic BackgroundWorker - My latest article!
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus) -
i can write a file in the any drive of XP operating System but i can not on vista. plz see my code and suggest me how i can write on VISTA operating System. Server = txtServerHost.Text.Trim(); User = txtUserName.Text.Trim(); Password = txtPassword.Text.Trim(); DBName = "db_outlook"; DataTable dt = new DataTable("Server Configuration"); dt.Columns.Add("Server"); dt.Columns.Add("User"); dt.Columns.Add("Password"); dt.Columns.Add("DBName"); dt.Rows.Add(Server, User, Password, DBName); dt.WriteXml(Application.StartupPath + "\\ServerInformation.bin"); Thanks in advance