Solved

Visual Web Developer Need Path to Web root directory

Posted on 2007-04-07
2
467 Views
Last Modified: 2013-11-27
Hello Experts,
I am using Visual Web Developer from VS2005.

I want my web page to open a sequential log file and write a record into it.  I have the following code which executes.  However, I have no idea where the record is written.  This is my vb code:
        Dim writer As StreamWriter = _
            New StreamWriter("admit.log")
        writer.WriteLine("This is a sample log record.")
        writer.Close()
I want the file admit.log written in my web root directory.  I need to determine the path to that directory.  I need something like the VBSCRIPT Server.MapPath.

Any ideas?  Thanks in advance
0
Comment
Question by:GeneM
2 Comments
 
LVL 14

Accepted Solution

by:
existenz2 earned 250 total points
ID: 18871862
Server.MapPath does the trick.
0
 
LVL 3

Author Comment

by:GeneM
ID: 18873243
You are correct.  I had tried it previously but could not make it work.  However, I discovered I had a problem with authorizations, so when that was corrected, the MapPath method worked great.

Thanks for the response.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

680 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