How to find your temporary asp.net executing assemblies location

Posted by Peter Kellner on August 18, 2008 · 1 min read

Seems, I keep forgetting where the temporary files asp.net uses. The reason it's nice to know is sometimes you may want to open them with Reflector to see the generated code.  Also, sometimes, you want to delete those files because asp.net is confused and is reusing old ones.  So, here is the magic lines of code you need.

<%@ Page Language="C#" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<script runat="server">
 
    protected void Page_Load(object sender, EventArgs e)
    {
        LabelWhere.Text = System.Reflection.Assembly.GetExecutingAssembly().Location.ToString();
    }
</script>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="LabelWhere" runat="server" Text="Label"></asp:Label>
    </div>
    </form>
</body>
</html>

Hope this Helps!