Solved

.NET File exists

Posted on 2009-04-03
2
302 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Expert Comment

by:David Robitaille
ID: 24060333
0
 
LVL 52

Accepted Solution

by:
Ryan Chong earned 500 total points
ID: 24060395
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 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