There is a website made using .net, the maker has gone and we can't find him.
For a long time we don't know the password of the sql server database, today I tried to reset the password and then found the website can't connect to the database!
However I've got the .cs and .aspx and .dll files, I checked the code and find it getting connection in the following way:
public string ConnectString
{
get
{
if (this.connectString == string.Empty)
{
System.Configuration.AppSettingsReader Reader = new AppSettingsReader();
connectString = (string)Reader.GetValue("conn", System.Type.GetType("System.String"));
}
return connectString;
}
set
{
connectString = value;
}
}
public SqlConnection SqlConnection
{
get
{
if (SqlCn == null)
{
SqlCn = new SqlConnection(ConnectString);
}
return SqlCn;
}
}
Since I've only known some JDBC and never touched .net, i've no ider how this works:
System.Configuration.AppSettingsReader Reader = new AppSettingsReader();
connectString = (string)Reader.GetValue("conn", System.Type.GetType("System.String"));
Can I find the connectString in some file so I can change the password back? I searched all the files I have and can't find any containing the keyword "pwd" or "database" is useful. Now I have a new database password, can I simply change the line:
SqlCn = new SqlConnection("server=127.0.0.1;database=****;uid=sa;pwd=****");
Still I want to know how to recompile the .cs to .aspx, and what I need to know to recover the website?