Shaitan00
02-01-2005, 08:22 AM
I am trying to post information to screen, in ASP.net I was told (and see everywhere) to use Response.Write. 1) I have been looking around but not 100% what Response.Write is supposed to do (messagebox?)
Currently I am using the following code:
HTML SOURCE CODE:
<body bgColor="#ffffff">
<form id="Form1" style="TEXT-ALIGN: center" method="post" encType="multipart/form-data" runat="server">
<INPUT id="fileUpdate" type="file" name="fileUpdate" runat="server"><br>
<INPUT id="subUpdate" onclick="subUpdate_ServerClick" type="submit" value="Upload" name="subUpdate" runat="server"><br>
</form>
</body>
ASPX.CS CODE:
private void subUpdate_ServerClick(object sender, System.EventArgs e)
{
string appDir = ConfigurationSettings.AppSettings["ApplicationDir"];
string updDir = ConfigurationSettings.AppSettings["UpdateDir"];
string SaveLocation = appDir + updDir + fn;
try
{
Response.Write(SaveLocation);
Response.Write("The file has been uploaded.");
}
catch ( Exception ex )
{
Response.Write("Error: " + ex.Message);
}
}
As you can see I am just trying to output the string SaveLocation (cannot debug ASP). I run the code with no errors but nothing occurs, seems like th Response.Write does not do anything. Can someone please help explain to me what I am doing wrong? Am I forgetting something or not using the
Response.Write correctly? Is there something else I should be using?
Currently I am using the following code:
HTML SOURCE CODE:
<body bgColor="#ffffff">
<form id="Form1" style="TEXT-ALIGN: center" method="post" encType="multipart/form-data" runat="server">
<INPUT id="fileUpdate" type="file" name="fileUpdate" runat="server"><br>
<INPUT id="subUpdate" onclick="subUpdate_ServerClick" type="submit" value="Upload" name="subUpdate" runat="server"><br>
</form>
</body>
ASPX.CS CODE:
private void subUpdate_ServerClick(object sender, System.EventArgs e)
{
string appDir = ConfigurationSettings.AppSettings["ApplicationDir"];
string updDir = ConfigurationSettings.AppSettings["UpdateDir"];
string SaveLocation = appDir + updDir + fn;
try
{
Response.Write(SaveLocation);
Response.Write("The file has been uploaded.");
}
catch ( Exception ex )
{
Response.Write("Error: " + ex.Message);
}
}
As you can see I am just trying to output the string SaveLocation (cannot debug ASP). I run the code with no errors but nothing occurs, seems like th Response.Write does not do anything. Can someone please help explain to me what I am doing wrong? Am I forgetting something or not using the
Response.Write correctly? Is there something else I should be using?