Not knowing what is the ASP.NET technology (Webforms or MVC) I will assume it's WebForms.
You can have a look at URL Redirecting and build you own rules. And you do this one time only to apply to all of the links that look like you want.
Scott Guthrie has a very nice post about it.
If what you want is to when it comes to that address redirect to a new one, it's quite easy as well.
First of all let's reuse the code, so you will redirect first to a commum page called, for example, redirectme.aspx
in that page you get the REFERER address using the ServerVariables or passing the Url in a QueryString, it's your chooise and then you can attach the title name, like:
private void Redirect()
{
// get url: www.mysite.com/picture/12345
string refererUrl = Request.ServerVariables["HTTP_REFERER"]; // using the ServerVariables or Request.UrlReferrer.AbsolutePath;
//string refererUrl = Request.QueryString["url"]; // if you are redirecting as Response.Redirect("redirectme.aspx?" + Request.Url.Query);
// split the URL by '/'
string[] url = refererUrl.Split('/');
// get the postID
string topicID = url[url.Length-1];
// get the title from the post
string postTitle = GetPostTitle(topicID);
// redirect to: www.mysite.com/picture/some-picture-title/12345
Response.Redirect(
String.Format("{0}/{1}/{2}",
refererUrl.Substring(0, refererUrl.Length - topicID.Length),
postTitle,
topicID));
}
to save time on the server do this on the first Page event
protected void Page_PreInit(object sender, EventArgs e)
{
Redirect();
}