Hi Sid,
I have created one sample that full-fill your requirement.
HTML
<div>
<asp:Label ID="lblConnection" runat="server" /><br />
<asp:Button ID="btnConnection" Text="Read ConnectionString" runat="server" OnClick="btnConnection_Click" />
</div>
Code
protected void btnConnection_Click(object sender, EventArgs e)
{
string txtpath = @"D:/Connection/ConnectionString.txt";
StreamReader sr = new StreamReader(txtpath);
String line = sr.ReadToEnd();
lblConnection.Text = line;
//use this in your code.
}
Screenshot
But why are you storing connection string in a text file instead of app.config/web.config. Which is more secure and manageable.