Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Path Problems

Reply
Thread Tools

Path Problems

 
 
Jordan S
Guest
Posts: n/a
 
      01-10-2005
I'm kind of new to all of this Web app development and have developed an
ASP.NET Web application under the default c:\inetpub\wwwroot\myApp.

I just went to move it to a hosted site and I'm having all sorts of trouble
following from the fact that the root in my development is actually *under*
the Default Web Site's root; whereas the root of the app in the hosted
environment is just the root, itself.

While I can go and recode the app so that it works in the hosted
environment, then it will break in my development machine.

What to do? I'm sure I'm not the first person to encounter this scenario -
what do you experts do to have root-relative paths match up between
development and production?

Thanks.



 
Reply With Quote
 
 
 
 
WJ
Guest
Posts: n/a
 
      01-10-2005

"Jordan S" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm kind of new to all of this Web app development and have developed an
> ASP.NET Web application under the default c:\inetpub\wwwroot\myApp.
>
> I just went to move it to a hosted site and I'm having all sorts of
> trouble following from the fact that the root in my development is
> actually *under* the Default Web Site's root;


Your applications do not need to be under the default c:\inetpub\wwwroot.
You can use the IIS/MMC to redirect your site to any folder within your box
at will. I am using Windows IIS since Windows NT 4.0 and now Server 2003
Standard and I have my own folder unless you use other webservers to host
your app.

> While I can go and recode the app so that it works in the hosted
> environment, then it will break in my development machine.
>


Never need to do this. Just code it and test your app in your Windows Xp PC
(as an example), once done, deploy it by doing the following:

> What to do?


Just copy the needed files to the host where your application is pointed to.
Tell your web server what is the default page (ie. Default.Aspx or
..html...).

John


 
Reply With Quote
 
 
 
 
Jordan S
Guest
Posts: n/a
 
      01-10-2005
Thanks - so just to clarify, I think I'll be fine if I do the following:
1. Create any old folder I want (e.g., C:\MyWebApp)
2. In IIS, make it a Web application (with C:\MyWebApp as the root).
3. Move all of my application files and folders into it
4. Fix all the path-specific logic throughout my app.

Is this something you more experienced developers would do to fix my app? Is
there an easier/better way?

Thanks.



"WJ" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> "Jordan S" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> I'm kind of new to all of this Web app development and have developed an
>> ASP.NET Web application under the default c:\inetpub\wwwroot\myApp.
>>
>> I just went to move it to a hosted site and I'm having all sorts of
>> trouble following from the fact that the root in my development is
>> actually *under* the Default Web Site's root;

>
> Your applications do not need to be under the default c:\inetpub\wwwroot.
> You can use the IIS/MMC to redirect your site to any folder within your
> box at will. I am using Windows IIS since Windows NT 4.0 and now Server
> 2003 Standard and I have my own folder unless you use other webservers to
> host your app.
>
>> While I can go and recode the app so that it works in the hosted
>> environment, then it will break in my development machine.
>>

>
> Never need to do this. Just code it and test your app in your Windows Xp
> PC (as an example), once done, deploy it by doing the following:
>
>> What to do?

>
> Just copy the needed files to the host where your application is pointed
> to. Tell your web server what is the default page (ie. Default.Aspx or
> .html...).
>
> John
>
>



 
Reply With Quote
 
=?Utf-8?B?U2NvdHQgU2ltb25z?=
Guest
Posts: n/a
 
      01-10-2005
Don't hardcode paths into your application. Make everything relative and use
Server.MapPath when you need physical locations.
 
Reply With Quote
 
WJ
Guest
Posts: n/a
 
      01-10-2005
"Jordan S" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks - so just to clarify, I think I'll be fine if I do the following:
> 1. Create any old folder I want (e.g., C:\MyWebApp)
> 2. In IIS, make it a Web application (with C:\MyWebApp as the root).
> 3. Move all of my application files and folders into it


On top of that, give appropriate access privilege to the web account that
runs the web site (not web server). Example: If you have a folder that
accepts user's uploaded files, then make sure to grant write access to the
appropriate account for that folder.

> 4. Fix all the path-specific logic throughout my app.
>

Sound like you are hard coding stuffs. If so, yes, clean them up, do not
hard code things such as "c:\sss\somthing.aspx". Example: If you want to
invoke Page2.aspx from a, say Default.aspx, then in Default.aspx, just say:
Response.Redirect("Page2.aspx");

> Is this something you more experienced developers would do to fix my app?
> Is there an easier/better way?


You may want to buy a good book about IIS, it is good to know inside out
although you need not to. This is the function of a web admin. not
developer.

John



 
Reply With Quote
 
Jordan S
Guest
Posts: n/a
 
      01-10-2005
Thank you very much.
I'm not hard coding anything from the root (nothing like
C:\SomeFolder\SomeOtherFolder\SomeFile.aspx). Rather I programmatically
determine the current application's root:
string m_appRootFolder =
System.Web.HttpContext.Current.Request.Application Path.ToString();
and then refer to folders under the root.

The problem I had was one of really understanding where my application root
was and the associated issues resulting from using the default XP/Pro
C:\inetpub\wwwroot\MyApp setup created by VS.NET. Everything's cool when the
app exists under the current Web site's root - but the production server
uses the root, itself. When I started this project I didn't think much about
it. Now I have to (simple, but important).






"WJ" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Jordan S" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Thanks - so just to clarify, I think I'll be fine if I do the following:
>> 1. Create any old folder I want (e.g., C:\MyWebApp)
>> 2. In IIS, make it a Web application (with C:\MyWebApp as the root).
>> 3. Move all of my application files and folders into it

>
> On top of that, give appropriate access privilege to the web account that
> runs the web site (not web server). Example: If you have a folder that
> accepts user's uploaded files, then make sure to grant write access to the
> appropriate account for that folder.
>
>> 4. Fix all the path-specific logic throughout my app.
>>

> Sound like you are hard coding stuffs. If so, yes, clean them up, do not
> hard code things such as "c:\sss\somthing.aspx". Example: If you want to
> invoke Page2.aspx from a, say Default.aspx, then in Default.aspx, just
> say: Response.Redirect("Page2.aspx");
>
>> Is this something you more experienced developers would do to fix my app?
>> Is there an easier/better way?

>
> You may want to buy a good book about IIS, it is good to know inside out
> although you need not to. This is the function of a web admin. not
> developer.
>
> John
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Server.MapPath() croaking with "failed to map path", but path is legal awbacker@gmail.com ASP .Net 0 05-12-2005 10:50 PM
how to get application path? Is that my method in getting path wrong? James Java 2 12-07-2004 11:59 AM
absolute path versus relative path in JSP Matt Java 3 07-08-2004 08:31 PM
Bizzare: Invalid path to Access mdb, path is good Keith-Earl ASP .Net 1 05-03-2004 03:25 PM
Tomcat returning 404 error when using additional path (/servlet/myServlet/extra/path/info) Mupota Muchelemba Java 1 02-04-2004 12:43 AM



Advertisments