Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to read contents of aspx files

Status
Not open for further replies.

fly231

Programmer
May 29, 2005
24
GB

Hi ,

Can anyone tell me how to read contents of an aspx file.
Like avoiding the tags and reading just the content ?

Any help would be greatly appreciated.

Thanks.
 
By the way, forgot to mention, this is for a simple website search.
Thanks.
 
i would think it's the same as reading any other HTML page...because .aspx pages still render things as HTML objects...

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
I used
string filePath = "c:\\inetpub\\
FileStream file = File.OpenRead(filePath);
StreamReader sr = new StreamReader(file);
string strTemp = sr.ReadToEnd();

pattern = @"<(.|\n)*?>";

string StripdText = Regex.Replace (strTemp,pattern,string.Empty);


This works with an HTML file but not with aspx file cause it doesn't strip off the <script> tags.


Can someone please tell me how to get rid of all the tags.
and also the extra white spaces.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top