Solved

.NET File exists

Posted on 2009-04-03
2
291 Views
Last Modified: 2013-11-26
I need to do an if statement based on if a file exists...hopefully with Server.mappath

If "~/gallery/" & Request.QueryString("id") & ".swf   exists
Session("src") = "~/gallery/" & Request.QueryString("id") & ".swf  
else
Session("src") = "~/gallery/default.swf "
0
Comment
Question by:lrbrister
2 Comments
 
LVL 18

Expert Comment

by:David Robitaille
Comment Utility
0
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 500 total points
Comment Utility
davrob60 is right.

so, for your question... try this:

Imports System.IO


then:

'...

If File.Exists(Server.MapPath("~/gallery/" & Request.QueryString("id") & ".swf")) Then
            Session("src") = "~/gallery/" & Request.QueryString("id") & ".swf  "
        Else
            Session("src") = "~/gallery/default.swf "
        End If

'..
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now