none
error :cannot find the file (html file control) RRS feed

  • Question

  • Hi to All,

    In my web application i am using an html file control to read an text file.I made the control as server control by applying property runat="server".When i am trying to read the file i am getting an error :could not find the file.

    I am providing the code which i had written  .
    Can any one look into this and clear the error.

      if (f.Extension.ToUpper() == ".TXT" && File1.Value.ToString()!=null)
    {
                         
                             StreamReader sr = new StreamReader(File1.Value.ToString());
                           
                             string line = sr.ReadLine();
                             while (line != null)
                             {
                                 string tt = line;
                                //char[] cc = new char[] { ' ' };
                                 string ttr = tt.Trim();
                                 if (ttr.Length <= 11)
                                 {
                                     cn.Open();
                                     string ls = "select * from TA_clientTagRoutes where vcclienttag='" + ttr + "'";
                                     SqlCommand cmds = new SqlCommand(ls, cn);
                                     SqlDataReader dr = cmds.ExecuteReader();
                                     if (dr.Read() == true)
                                     {
                                         cn.Close();
                                         exists = exists + ttr+";";
                                         line = sr.ReadLine();
                                         inv = inv + 1;
                                     }
                                     else
                                     {
                                         cn.Close();
                                         cn.Open();
                                         string li = "insert into TA_clientTagRoutes values ('" + line + "','airtelbulk','airtelmumbulk','bsnlbulk','0','0')";
                                         SqlCommand cmdi = new SqlCommand(li, cn);
                                         cmdi.ExecuteNonQuery();
                                         cn.Close();
                                         vsend = vsend + line+";";
                                         iv = iv + 1;
                                         line = sr.ReadLine();
                                     }


                                 } //end of if
                                 else
                                 {
                                     ivsend = ivsend + line+";";
                                     line = sr.ReadLine();
                                     inv = inv + 1;
                                 }

                             }
                             Session["v"] = vsend;
                             Session["vi"] = ivsend;
                             Session["vexists"] = exists;
                             Response.Redirect("view.aspx");

                         }

    thank you,
    sanjith

    rao
    • Edited by sanjithraop Thursday, August 28, 2008 1:47 PM forgot to supply the code
    Thursday, August 28, 2008 1:45 PM

Answers

  •  Hi sanjithraop,

     This forum is to support Interoperability questions on the Windows Protocols Open Specifications.

    I would suggest that you post your question to a more suitable forum like:

    http://forums.msdn.microsoft.com/en-US/csharpgeneral/threads/

    Visual C# General


    I'm assuming that you are developing in C# but if not, please post in the forum for the correct language.


    Thanks and regards,

    SEBASTIAN CANEVARI - MSFT SEE Protocol Documentation Team
    Friday, August 29, 2008 1:43 AM