Click to See Complete Forum and Search --> : Need help converting ASP code to ASP.NET


nvdp
02-03-2009, 02:18 PM
I have the following ASP code that works great in ASP. Basically, the idea is to check to see if a file exists. If it does, then redirect to a text file. If not, then redirect to Google. I need some help creating this code in ASP.NET. I work in IT, but not in ASP.NET - so this is new to me. Any help would be appreciated.

<%
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists ("D:\Inetpub\Wwwroot\smart_avail.txt") Then
Response.redirect "/test/asp/main.aspx"
Else
Response.redirect "http://www.google.com"
End If
%>

chazzy
02-03-2009, 06:58 PM
you could use System.IO.File.Exists, which would be in your code behind page.

nvdp
02-06-2009, 10:54 AM
Thanks for the response. What would the code look like using System.IO.File.Exists?

chazzy
02-10-2009, 08:04 AM
http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx