Link to home
Start Free TrialLog in
Avatar of rito1
rito1

asked on

Search and replace text within a file using C#

Hi All,

I have a file on the server called:

C:\inetpub\wwwroot\mypage.aspx

... I have appended the code for this page.

On the fly using C#, I would like to be able to replace the code ' Text="" ' within the 1 literal control with Text="1".

Please could anyone show me how to achieve this?

Many thanks,

Rit
<%@ Page Language="C#" MasterPageFile="~/content.master" %>
<script runat="server">
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="PageID" Runat="Server">
<asp:Literal ID="litPageID" runat="server" Text=""></asp:Literal>
</asp:Content>

Open in new window

Avatar of rito1
rito1

ASKER

If it helps, there will not be any other Text="" attributes contained within this file.
ASKER CERTIFIED SOLUTION
Avatar of Mike_Mozhaev
Mike_Mozhaev

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rito1

ASKER

HI Mike_Mozhaev,

I am just checking this out.

Thanks,

Rich
Avatar of rito1

ASKER

Perfect, thanks.

Rit