title: Dynamic imageURL in asp.net c#
body: <p>At the moment i have this: </p>
  
  <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl2.ascx.cs" Inherits="Drawing.Usercontrols.WebUserControl2" %&gt;
  &lt;asp:Image ID="Image1" runat="server" alt="Image Not Found" ImageUrl="~/images/k8up7l1i.bmp"/&gt;
  </code></pre>
  
  <p>in the webUserControl2.ascx page.</p>
  
  <p>In WebUserControl2.ascx.cs page, all of the logic is found. An Image is generated there, and then saved to a path (C:\Work Drawing\Drawing\Drawing\images)
   where:</p>
  
  <pre><code>string thisPathName = System.Web.Hosting.HostingEnvironment.MapPath("~/Images/" + randomFileName);
  </code></pre>
  
  <p>My question is, can i call a method "getPathName()" from the asp page (where ImageUrl is, instead of a static URL). So each time i call it, the new image will be displayed in the browser with that pathname generated in the c# code?</p>
  
  <p>Please notify me if the question was unclear.</p>