我在下面给出的代码中有一个错误:这表明文件和服务器的路径未正确定义。请帮我解决这个问题,否则请建议我一些异常检测代码以成功运行它
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.IO;
using System.IO.Ports;
namespace DDOS
{
public partial class client : Form
{
SqlCommand cmd;
SqlDataReader dr;
SqlConnection cn;
public static string fileName;
public static string Servername;
string path;
public client()
{
InitializeComponent();
}
private void login_Load(object sender, EventArgs e)
{
txtUname.Enabled = true;
btnLogin.Enabled = true;
}
public void btnLogin_Click(object sender, EventArgs e)
{
cn = new SqlConnection("Data Source=MANIKANDAN-PC\\SQLEXPRESS;InitialCatalog=DDOS;Integrated Security=True");
cn.Open();
string server = "" + txtUname.Text + ".txt";
Servername = "" + textBox1.Text + "";
string path3 = "\\\\" + Servername + "/REPUTE/" + server + "";
if (System.IO.File.Exists(path3))
{
lblError1.Text = "";
lblError1.Text = "Contact Admin To use the tool";
txtUname.Text = "";
txtPass.Text = "";
}
else
{
fileName = "uname.txt";
Servername = "" + textBox1.Text + "";
path = "\\\\" + Servername + "/REPUTE/" + fileName + "";
FileStream fileStr = new FileStream(path, FileMode.Create, FileAccess.Write);
StreamWriter sw = new StreamWriter(fileStr);
sw.Write(txtUname.Text);
sw.Close();
fileStr.Close();
sendFile objsendfile = new sendFile();
objsendfile.Show();
}
}//i have error in this area