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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Error:server.mappath

Error:server.mappath

Scheduled Pinned Locked Moved ASP.NET
csharpvisual-studiosysadmindata-structuresregex
5 Posts 4 Posters 0 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.
  • R Offline
    R Offline
    rockram
    wrote on last edited by
    #1

    private void LoadDictArray(string strPath, string strBegin) { bool boolStart = false; string strCurrent = ""; string strFinal = ""; string filepath = "C:/Documents and Settings/Owner/My Documents/Visual Studio 2005/sample/dict-large.txt"; // Open our dictionary file StreamReader srDictionary = new StreamReader(Server.MapPath("dict-large.txt"));--->Error Line // Check each line and loop while there is another while (srDictionary.Peek() != -1) { // Read the current line strCurrent = srDictionary.ReadLine(); // Does the first character match our word's if (strCurrent.Substring(1).ToLower() == strBegin.ToLower()) { boolStart =true; // Only add words beginning with the same letter as the current word strFinal += strCurrent; } // Exit, we have all our relevant words if (boolStart == true & strCurrent.Substring(1).ToLower() != strBegin.ToLower()) { break; // TODO: might not be correct. Was : Exit While } } // Close the streamreader srDictionary.Close(); char[] char1 ={ '\n' }; // Split our string into an array of suitable words strDictArray =strFinal.Split(char1); }

    I R 2 Replies Last reply
    0
    • R rockram

      private void LoadDictArray(string strPath, string strBegin) { bool boolStart = false; string strCurrent = ""; string strFinal = ""; string filepath = "C:/Documents and Settings/Owner/My Documents/Visual Studio 2005/sample/dict-large.txt"; // Open our dictionary file StreamReader srDictionary = new StreamReader(Server.MapPath("dict-large.txt"));--->Error Line // Check each line and loop while there is another while (srDictionary.Peek() != -1) { // Read the current line strCurrent = srDictionary.ReadLine(); // Does the first character match our word's if (strCurrent.Substring(1).ToLower() == strBegin.ToLower()) { boolStart =true; // Only add words beginning with the same letter as the current word strFinal += strCurrent; } // Exit, we have all our relevant words if (boolStart == true & strCurrent.Substring(1).ToLower() != strBegin.ToLower()) { break; // TODO: might not be correct. Was : Exit While } } // Close the streamreader srDictionary.Close(); char[] char1 ={ '\n' }; // Split our string into an array of suitable words strDictArray =strFinal.Split(char1); }

      I Offline
      I Offline
      Imran Khan Pathan
      wrote on last edited by
      #2

      You did not type an error message.

      rockram wrote:

      string filepath = "C:/Documents and Settings/Owner/My Documents/Visual Studio 2005/sample/dict-large.txt"; // Open our dictionary file StreamReader srDictionary = new StreamReader(Server.MapPath("dict-large.txt"));--->Error Line

      Does dict-large.txt file exist in application folder? If it exist then why did you get file path from local machine? If it does not exist then you can not make server.MapPath try this if it does not exist.

      string filepath = "C:/Documents and Settings/Owner/My Documents/Visual Studio 2005/sample/dict-large.txt";

      // Open our dictionary file
      StreamReader srDictionary = new StreamReader(filepath);

      regard Khan

      please don't forget to vote on the post that helped you.

      1 Reply Last reply
      0
      • R rockram

        private void LoadDictArray(string strPath, string strBegin) { bool boolStart = false; string strCurrent = ""; string strFinal = ""; string filepath = "C:/Documents and Settings/Owner/My Documents/Visual Studio 2005/sample/dict-large.txt"; // Open our dictionary file StreamReader srDictionary = new StreamReader(Server.MapPath("dict-large.txt"));--->Error Line // Check each line and loop while there is another while (srDictionary.Peek() != -1) { // Read the current line strCurrent = srDictionary.ReadLine(); // Does the first character match our word's if (strCurrent.Substring(1).ToLower() == strBegin.ToLower()) { boolStart =true; // Only add words beginning with the same letter as the current word strFinal += strCurrent; } // Exit, we have all our relevant words if (boolStart == true & strCurrent.Substring(1).ToLower() != strBegin.ToLower()) { break; // TODO: might not be correct. Was : Exit While } } // Close the streamreader srDictionary.Close(); char[] char1 ={ '\n' }; // Split our string into an array of suitable words strDictArray =strFinal.Split(char1); }

        R Offline
        R Offline
        rockram
        wrote on last edited by
        #3

        code: private void LoadDictArray(string strPath, string strBegin) { bool boolStart = false; string strCurrent = ""; string strFinal = ""; string filepath = "C:/Documents and Settings/Owner/My Documents/Visual Studio 2005/sample/dict-large.txt"; // Open our dictionary file StreamReader srDictionary = new StreamReader(Server.MapPath("filepath"));--->Error Line // Check each line and loop while there is another while (srDictionary.Peek() != -1) { // Read the current line strCurrent = srDictionary.ReadLine(); // Does the first character match our word's if (strCurrent.Substring(1).ToLower() == strBegin.ToLower()) { boolStart =true; // Only add words beginning with the same letter as the current word strFinal += strCurrent; } // Exit, we have all our relevant words if (boolStart == true & strCurrent.Substring(1).ToLower() != strBegin.ToLower()) { break; // TODO: might not be correct. Was : Exit While } } // Close the streamreader srDictionary.Close(); char[] char1 ={ '\n' }; // Split our string into an array of suitable words strDictArray =strFinal.Split(char1); } The dict-large.txt file is in the solution explorer itself

        E N 2 Replies Last reply
        0
        • R rockram

          code: private void LoadDictArray(string strPath, string strBegin) { bool boolStart = false; string strCurrent = ""; string strFinal = ""; string filepath = "C:/Documents and Settings/Owner/My Documents/Visual Studio 2005/sample/dict-large.txt"; // Open our dictionary file StreamReader srDictionary = new StreamReader(Server.MapPath("filepath"));--->Error Line // Check each line and loop while there is another while (srDictionary.Peek() != -1) { // Read the current line strCurrent = srDictionary.ReadLine(); // Does the first character match our word's if (strCurrent.Substring(1).ToLower() == strBegin.ToLower()) { boolStart =true; // Only add words beginning with the same letter as the current word strFinal += strCurrent; } // Exit, we have all our relevant words if (boolStart == true & strCurrent.Substring(1).ToLower() != strBegin.ToLower()) { break; // TODO: might not be correct. Was : Exit While } } // Close the streamreader srDictionary.Close(); char[] char1 ={ '\n' }; // Split our string into an array of suitable words strDictArray =strFinal.Split(char1); } The dict-large.txt file is in the solution explorer itself

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

          Well its obvious it dooesnt recognise the file location. You sure this is correct file location? It might not recognise it because there is spaces in the file address

          1 Reply Last reply
          0
          • R rockram

            code: private void LoadDictArray(string strPath, string strBegin) { bool boolStart = false; string strCurrent = ""; string strFinal = ""; string filepath = "C:/Documents and Settings/Owner/My Documents/Visual Studio 2005/sample/dict-large.txt"; // Open our dictionary file StreamReader srDictionary = new StreamReader(Server.MapPath("filepath"));--->Error Line // Check each line and loop while there is another while (srDictionary.Peek() != -1) { // Read the current line strCurrent = srDictionary.ReadLine(); // Does the first character match our word's if (strCurrent.Substring(1).ToLower() == strBegin.ToLower()) { boolStart =true; // Only add words beginning with the same letter as the current word strFinal += strCurrent; } // Exit, we have all our relevant words if (boolStart == true & strCurrent.Substring(1).ToLower() != strBegin.ToLower()) { break; // TODO: might not be correct. Was : Exit While } } // Close the streamreader srDictionary.Close(); char[] char1 ={ '\n' }; // Split our string into an array of suitable words strDictArray =strFinal.Split(char1); } The dict-large.txt file is in the solution explorer itself

            N Offline
            N Offline
            N a v a n e e t h
            wrote on last edited by
            #5

            rockram wrote:

            string filepath = "C:/Documents and Settings/Owner/My Documents/Visual Studio 2005/sample/dict-large.txt";

            I doubt ASP.NET can access files in this way. You need to use "Server.MapPath" to map the file names.

            All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

            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