Click here to Skip to main content
15,910,661 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends,

I have an browse button when clicking on that browse button it is searching for
files in the computer and if i press ok then it has to be read.but the reading is not possible.What code should i suppose to write in the controller and view.I have used
fileReader and StreamReader methods.what should i suppose to do

Friends i am using asp.net mvc 3 web application please tell me regarding this





its urgent

please provide any alternative ways to rectify my problem







Thank you all
Posted
Updated 18-May-12 19:44pm
v3

import IO namespace
C#
using System.IO;


use below code read all content of a file
C#
StreamReader objReader=new StreamReader(fullFilePath);
string fileContent=objReader.ReadToEnd();
objReader.Close();


Best of luck Priya!
 
Share this answer
 
Comments
priya0143 19-May-12 0:40am    
Thank you sanjay
but i have already used the system.io namespace
and also the stream reader and file reader
Hi Priya0143,

Please refer this link How to: Read From a Text File (C# Programming Guide)[^]
 
Share this answer
 
Comments
priya0143 19-May-12 1:22am    
Thanks Maulik

i am using asp.net mvc3 web application what code should i write in controller and what code should i write in view

please tell me
Hi,

try this
string s = System.IO.File.ReadAllText( path );
refer this link http://stackoverflow.com/questions/8939640/how-to-read-a-doc-and-docx-file-in-asp-net-mvc3-and-display-in-textbox[^]
hope it help u
best Luck
Happy Coding:)
 
Share this answer
 
v2
Comments
priya0143 19-May-12 4:58am    
Thank you
but its not working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900