Web Forms :: Relative Path Of Image In Master Page?

Jul 22, 2010

I have got a master page(Project>>MasterPages>>MainPage.master) and some images in that page with some path like "../../Images/bg_main_menu.png".

I refer this master page in two forms. One of those form is oresent in the path :

Project>>Forms>>Form1.aspx and the other one is : Project>>Forms>>NewFolder>>Form2.aspx

Now for Form2.aspx the image is not getting loaded.

I tried the image path with "~Images/bg_main_menu.png". But it is not working.

View 2 Replies

Similar Messages:

Relative Path From Master Page File?

Feb 12, 2010

Question about paths while working in Visual Studio. In my master page I have some paths to load css files as well as javascript files.

My first question is if I use relative paths, should the relative path be from the location of the master page file? For example if I keep all my master page files in a folder off the site root called MasterPages should I assume that is the starting point for my relative paths to load the css files? If that master page is used to wrap an aspx file several directories down the tree is the hard coded relative path still valid?

Second question, is there a way to use absolute paths so that everything works on my local machine as well as when I move the files up to the webroot? For example my app path on my local machine may be localhost/myappdir/default.aspx but when i move the app to the server there is no myappdir and the default.aspx is in the webroot. I do not want to have to change paths in the files after they are moved up to the server. currently I have;

src="<%= VirtualPathUtility.ToAbsolute("~/lib/css/style.css")%>"

but this way Visual Studio cannot find the css file to update intellisence

View 4 Replies

AJAX :: SlideShowExtender Control Image Relative Path?

Feb 20, 2011

I am using SlideShowExtender and I am using a Slideservice webservice located also in root folder. It works fine. My image folder is in ROOT FOLDER. But I have member webpage folders and a general web pages folder. Now, when I click on webpages of any of these folders, the slideshowextender stops working because it looks for my IMAGE folder in those Webpage Folders. I know this happens because I can see it trying to download the image from that URL which DOESNT EXIST(looking for my image folder in webpage folders).

How do I make a relative URL for the images so that the slideshowextender still POINTS to the ROOT FOLDER of images and displays images at all times.

I cannot make the slideshowextender work when I am logged into the system.

View 4 Replies

Java Script - Relative Image-path In Js-file And Masterpages?

Mar 23, 2011

I'm using a jQuery Menu in my Masterpage. This masterpage is used for several pages in the root directory of the webapplication. Now i have a page in a sub-directory and all the image-, stlyesheet and javascript-files paths are invalid there. I solved it almost by using servercontrols, tilde(~) and adding scriptreferences to the ScriptManager as you can see here:


I could use absolute paths, but that would work only on the productive system and not on the development systems. Is there no other way to handle this?

View 2 Replies

Mapping Of Relative Path To Absolute Path Of Webpage Links?

Apr 8, 2010

I am Final Year IT Engineering student. I am Doing Content Management System in ASP.net for my college. I have given link on my master page for various pages in the application; where I have specified only relative path of those pages. When I run this project and follow any link it works well for only first time and for second time when I click any link it .net run time environment unable to find the absolute address of that page.

View 2 Replies

Converting Relative Path To Tilde Path?

Apr 4, 2010

I have this master page, that uses a few .js files and a flash animation.

the <script> and <object> tags that are used to embed these in the page take in relative paths as src. However, since the pages .aspx, i'll need to convert these into tilde paths, ie. somehow change the relative paths to tilde path (is this the absolute path?), so that i can use the master page in any of my pages in subfolders as well. if this question has been posted b4, kindly give me a link... i've not been able to find a solution.

View 3 Replies

MVC :: Routing Relative Path Instead Of Absolute Path?

Jun 9, 2010

When I write following code in my view

<% Url.Action("Logon") %>
the mvc framework generates
/Account/Logon ({controller}/{action})
as path.
'/Account/Logon' path is an absolute path. Is there a way to change is to a relative path, like Account/Logon or ../Account/Logon.

Also, when I use the Html.Beginform(), the mvc framework generates <form action="/account/logon"..., I want to change this to <form action="account/logon"...So, problem is that I want relative paths instead of absolute path.

View 6 Replies

Web Forms :: How To Return A Relative Path

Apr 19, 2010

what it does at the moment is return an absolute path for example h:myfile . however, this is causing me problems because when browsing to the page, it is not returning the file i need because it is looking for a h: drive which the client machine does not have. so i was thinking i need to return a relative path so the not looking straight to the h: drive and rather it is just looking for the filename. i have also created this as a virtual directory on iis which is where is looks for the file location.

View 8 Replies

C# - Absolute Path And Relative Path?

Oct 13, 2010

i am fetching image using webservice into dataset and displaying for that its to be get worked after deployment i have done following line of code but its still not able to display the image after deployment

String imageName = row["ImageName"].ToString();
String physicalPath = HttpContext.Current.Request.Url.AbsoluteUri.ToString();
String imagePath = physicalPath.Substring(0, physicalPath.LastIndexOf("/",
StringComparison.OrdinalIgnoreCase) + 1) + imageName;

View 3 Replies

Web Forms :: Server.MapPath Displays Path As Relative?

May 4, 2010

I have a web application that uses Server.MapPath to specify the exact physical path of as part of upload image.

For example if I do Server.MapPath("/")

I get this:


I was expecting something like this:


I need to use Server.MapPath not only for image upload but several other uses.

View 2 Replies

C# - Is There A Built-in Create An Absolute (fully Qualified) Url From A Relative Path Such As "~/page.aspx" Given The Current URL?

Dec 8, 2010

Scenario is I have a application relative url like "~/path/to/page.aspx?query=string". I need to programatically create a web request to that page and currently using WebRequest.Create. The problem is WebRequest.Create requires a fully qualified url including the protocol/domain/port etc.I have access to the current Request.Url object but there doesn't seem to be an easy way to get just the base url keeping the protocol (HTTP vs HTTPS) as well as any port numbers as well as the path to the applicationI mean all the info there, so if need be I could just take all the parts and combine them but it seems like it might be error prone and it would be great to have something built-in that's well tested to do the job. Page.ResolveUrl gets me almost there, but it's missing the protocol and the domain/port.

View 1 Replies

How To Get A Relative Path In MVC

Sep 9, 2010

How do you calculate a relative path in ASP.NET MVC?

View 2 Replies

Getting Relative Path In JavaScript?

Jun 21, 2010

I've got this app where I'm using an IHttpHandler to serve JSON data to my JavaScript method.


This works fine on my "localhost" webserver, but I've also got a staging server for my clients to use. http://staging.infinitas.ws/ClientSite/

The problem that I'm having is that when the app is hosted on the staging server, the theSource is mapped incorrectly (contains /ClientSite/). I could do something like a String.Replace but I'm looking for a more elegant way of achieving this.

View 1 Replies

Get A FileStream From A Relative Path?

Apr 24, 2010

I am trying to get a FileStream from a relative path. The file is in my project, but when I try to do that it automatically appends C:\ in front of that.

1. Does the FileStream only works if the file is on a local Hard Dive?

2. Also if it works from the local hard drive, then does my application needs some permission to read the file from C Drive?

View 2 Replies

.net - Absolute Vs Relative Path?

Dec 14, 2010

Possible Duplicate: Absolute path & Relative Path

When to use absolute path, relative path and what is the difference between both?

View 2 Replies

Relative Path - Different Project?

Sep 20, 2010

I have three projects inside my solution and i using some same images on all of three projects. How can i create relative path from one project to another?

View 4 Replies

C# - Calculating Relative Path Change?

Oct 6, 2010

Assuming I have a .css file with the following linebody { background-image: url('../images/bg.png') }My build process does some CSS magic and eventuall move this file from

This invalidates the url statement in the file and needs re-written to ../Content/images/bg.pngThis is my question - given the original file location, the new file location and the background-image url in the file is there a reusable way calculate a new relative path for the image?In case someone doesn't know css urls should be relative to the css file it is contained within.

View 2 Replies

Load A Pdf File With Relative Path?

Dec 7, 2010

my asp.net program have to open pdf files, these files are contained in a directory named "pdf",

The problem is: The webpage doesn't find the relative directory "/pdf" ; to solve the problem I have to write the exaclty path "C:inetpubwwrootsitepdf" butI want to use only the relative path to avoid other problems.

View 1 Replies

C# - Use A Relative Path In XDocument.Load?

May 6, 2010

I have an XML file named PageData.xml in my App_Data folder. I want to populate an XDocument with this file using XDocument.Load.

If I supply the full physical path it works, i.e.:

XDocument vXDoc = XDocument.Load("/Work/Project/Web/100413 Dev/App_Data/PageData.xml");

...where "Work" is a folder on my C: drive.

If I try a relative path like this, though, I get a DirectoryNotFoundException:

XDocument vXDoc = XDocument.Load("AppData/PageData.xml");

"Could not find a part of the path 'C:Program Files (x86)Common FilesMicrosoft SharedDevServer10.0AppDataPageData.xml'."

This is obviously wrong, but there must be an easy way to set the correct relative path?

View 1 Replies

MVC :: Relative Virtual Path Is Not Allowed Here?

Oct 29, 2010

OK, I've seen a lot of ambiguous errors, but this was is in the top 20 or so. I have a RenderPartial that looks like this:


When the view loads, I get this error:

The relative virtual path '~Areas/User/Views/Shared/ProjectStats.ascx' is not allowed here. That really helps. Why isn't it allowed there? What's wrong with it? Just above it I have other PartialRender calls that work without a problem. They're created exactly the same way. Here's another:


This works fine. I thought maybe it was due to accessing a view from another Area, but I added a partial view to that Area's folder and it still didn't work.

View 3 Replies

MVC :: Get View Relative Path In Code Behind

Jan 22, 2010

i would know if is possible and how i can retrieve the current relative path of the view that is executed. The code is in a model file (C#)

View 2 Replies

Get A Path Relative To The Current Address?

Jan 22, 2010

Suppose I have a resource located in ~/Resources/R1.png This resource's relative URL will vary depending on the current address.

For instance: If I'm at www.foo.com/A/B/C/D.aspx and the www.foo.com/A is the root path including Virtual Directory, then the path relative to the current address of ~/Resources/R1.png is ../../../Resources/R1.png

How can I get this relative path?


I want a web path that I can use in a web page, not a server path.

View 4 Replies

Get The Relative Path In The Class Library?

Sep 7, 2010

I have to access a relative path of the XSD file to validate a XML file. The XML file and the XSD file are part of the class library. How do I access the relative path in the class library?

In case of website, I would use server.mappath(path). Is there anything similar to get the virtual path to the corresponding physical directory on the server in the class library?

View 2 Replies

Web Forms :: Relative Paths With Master Pages?

Sep 28, 2010

How do I deal with master pages and relative paths especially when dealing with sub-folders?

View 1 Replies

Configuration :: Relative Path For Data Source?

Oct 8, 2010

I am doing SOA architecture and the data base is in service side ie.within the project(website 7)

how can i can mention relative path for the data source ?

OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\sathiyabalu\My Documents\Visual Studio 2005\WebSites\WebSite7\App_Data\alumni_member.mdb");

View 1 Replies

Copyrights 2005-15 www.BigResource.com, All rights reserved