Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2005, 02:15 AM
Authorized User
 
Join Date: Feb 2005
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ashokparchuri Send a message via Yahoo to ashokparchuri
Default after Uploading...?

Hi,

   i uploaded my site and when i am doing my project i specified http://localhost/xyzx/123.gif for images and all

    but now when i upload into server it was not showing the images.

i heard that we have to do some changes in web.config or we have to write a program to take the server address insted of local host.

can anybody give a sample program...?

  thanks in advance-Ashok Parchuri
 
Old June 10th, 2005, 03:48 AM
Authorized User
 
Join Date: Nov 2004
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to avanishp
Default

you have to give image file address virtual like if aspx page is on root and images file is in 'images' folder on root then image path should be "images/123.gif". If you give address like this you will not have to change address anywhere you upload site.



 
Old June 10th, 2005, 04:11 AM
Authorized User
 
Join Date: Jul 2004
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to pass the physical path of the image to display
it on the page. Server.MapPath gives you the physical path
of the folder in which you have stored the image.

Use:
Server.MapPath("123.gif")



 
Old June 10th, 2005, 06:12 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Spacy,

I'm curious why you are recommending the physical address?

Ashok,
When you put a resource URL in a .NET property that expects a resource (such as HyperLink.NavigateUrl or Image.ImageUrl, then you can use the following syntax:

   ~/resourceDir/resource

The ~ character gets replaced with the application root URL. If your web application is called "myapplication" a reference to "~/images/button.gif" will get emitted by ASP.NET like this: "/myapplication/images/button.gif". (This is how it has to work when developing off of a virtual directory of IIS.) If you then move the application to a web host where your website is one of many on the same server then you'll usually reference the site with a root address (www.mywebsite.com). Now the same image URL will get emitted like this: "/images/button.gif".


The second scenario is a little bit harder to deal with. If you have what amounts to hard coded URLs to resources (i.e. they are not set or bound to properties that expect URLs as mentioned above) then you have to be careful how you emit those. There is a method on the Page class called "ResolveURL()" which will do the ~ resolution for you. Then the situation I described earlier will apply and you won't get broken resources.

The important thing is to NEVER use fully qualified URLs unless they are going to "offsite" resources (such as references to production web services or other sites or their resources).

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Before Uploading ashokparchuri General .NET 1 June 7th, 2005 07:17 AM
Help in uploading sonurijs Pro JSP 3 March 5th, 2005 04:54 PM
Uploading derek Dreamweaver (all versions) 4 March 8th, 2004 04:28 PM
about uploading shine SQL Server ASP 1 June 5th, 2003 06:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.