.NET File exists

Posted on 2009-04-03
Medium Priority
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  
Session("src") = "~/gallery/default.swf " 
Question by:lrbrister
LVL 18

Expert Comment

by:David Robitaille
ID: 24060333
LVL 56

Accepted Solution

Ryan Chong earned 2000 total points
ID: 24060395
davrob60 is right.

so, for your question... try this:

Imports System.IO



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


Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

SingleRun is a tool that ensures that only one instance of an application is started, running it again brings the application to focus.
This article describes and provides a custom-made tool I wrote to give businesses a means of identifying commercial music content, without having to expend too much effort. Business recordings are easily identified from possibly illegal music files …
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…
Watch the video to know how one can repair corrupt Exchange OST file effortlessly and convert OST emails to MS Outlook PST file format by using Kernel for OST to PST converter tool. It can convert OST to MSG, MBOX, EML to access them. It can migrate…

621 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