C# - Linking To Resources (img, Css, Js) From Different Paths?

Feb 28, 2011

Iam new to ASP.NET and poking around my first ASP Web Application projects in .NET 4.0 I have problem, which I can't solve, and google searches does not bring any joy. So I would ask for and/or explanation of following problem:

Assume that I have set up following project structure:

default.aspx
[gfx] (dir)
[images]
picture.jpg
[css]
stylesheet.css

[Code]....

View 5 Replies


Similar Messages:

MVC :: Linking Resources For Modal Dialog?

May 28, 2010

I am using jquery to display modal dialogs thought my app as certain events happen. I have created a seperate partial view that contains the html but i was wondering where best to handle the stylesheet and css registration. One option would be to always have these two resources linked in the head section of the master page, but is the wasteful since it is only needed when a modal is displayed? Or should I put them in the partial view, but if I did this, they would not be added to the head section.

View 2 Replies

Web Forms :: Resource Name '.Resources.resources' Cannot Be Used More Than Once

Feb 3, 2011

I have recently upgraded to VS 2010 and converted my web site into a web application. Now, when I attempt to build, I receive the error:

Resource name '<name>.Resources.resources' cannot be used more than once.

There is no page name or anything, and I have completely exhausted all that Google has to offer.

View 2 Replies

Getting Different Paths Using HttpPostedFileBase?

Feb 7, 2011

See the following code. I'm uploading files, Yet i'm getting different results from difference browsers.

Firefox var path = "about.restaurant.jpg"
yet in ie6 path = "D:devxxxxxxxxxxxxxxxWebsiteimagesabout.restaurant.jpg"
foreach (string file in Request.Files)

[code]...

View 1 Replies

MVC :: Want To Create Two Controllers/Paths?

Sep 16, 2010

I am wanting to create a path somewhat like this: /Administration/News and have it forward to a News controller instead of it being the action.How would I go about this?

View 3 Replies

Formatting A String - Paths

Jan 7, 2011

I have the following code, which generates insert queries

For Each f As String In Directory.GetFiles(d)
objSQLStringBuilder.Append("insert into table1 (full_path, file_name) values ('" & f.Replace("'", "''") & "', '" & f.Remove(0, Len(d) + 1).Replace("'", "''") & "');")
Next

However, the paths which it finds are formatted as follows c:program filesmicrosoft officewinword.exe I need to format the paths as follows file:///c:/program%20files/microosoft%20office/winword.exe. How can I modify the above code to do this?

View 5 Replies

HTML Img - ASP Image And Relative Paths

Mar 4, 2011

What is the correct way to reference an image in ASP.NET for live deployment on IIS? The following works in dev and production:

<asp:ImageButton ID="ibnEdit" runat="server" OnClick="ibnEdit_Click" ImageUrl="~/App_Themes/Default/images/one.png" Visible="false" ToolTip="Edit" />

The following doesn't work in either: (why not?)

<img src="~/App_Themes/Default/images/two.gif" />

The following works in dev but not in production:

<img src="../App_Themes/Default/images/two.gif" />

View 2 Replies

Configuration :: Deployed DLL Contains Wrong Paths?

Sep 30, 2010

This may be a dumb question, but I've got a DLL that I compile and reference locally in a web site project and everything runs just fine. When I deploy this solution to the test server, I get an "Object reference not set to an instance of an object." error and the stack trace displays the files with their paths that are causing the error. The thing is, the paths being displayed are the absolute path as they existed on my development machine. Here's the stack trace:.........................

View 3 Replies

C# - Routing And Physical Paths In Web.config?

Jul 22, 2010

I use ASP.NET routing to rename the full paths of my URLs (ie. /page1/page2/file.aspx would just become /file.aspx). This doesn't work with web.config authorization, because that uses physical path/folder names.

View 1 Replies

Vb.net - .NET Theming Programatically : Image Paths?

Mar 14, 2011

We have a multilingual site, or culture-sensitive, and some of the static content now needs to be targeted; for this I'm using themes as it seems the easiest way to achieve what I want, but I can't for the life of me get the images to pick up.I'm setting the theme in code-behind, and thought at first that maybe this was the issue, but on checking up it looks like I'm doing the right thing (setting on Pre-Init).

I expect to be able to reference images using relative paths where App_Themes/ThemeName/ is automatically resolved, such as:

<asp:Image runat="server" ImageUrl="imagesimage.jpg"/>

For whatever reason, however, the image isn't being pulled through at all.This is the code we have in place for setting the theme (the only really relevant part, I'm sure, being the Theme = CurrentSite.CultureName, which is applied successfully):

Private Sub SetTheme()
Dim themesPath = Server.MapPath("~/App_Themes")
If Directory.Exists(themesPath) Then[code]...

In the above code, CurrentSite.CultureName would be a language culture name (for example, en-gb, or nn-no) that does have an existing corresponding theme folder containing all required resources.Pages do have EnableTheming set to True. Also, I have tried removing the theme-setting code and applying the theme in the page using Theme="en-gb" to no avail.

Is there anything immediately evident as to why the URLs aren't resolved?

View 1 Replies

C# - Mapping A Filename To Paths On A Server?

Jun 28, 2010

I have a problem with my code. My code is using the fileupload control to browse for a filename when you add a filename it processes it and the code runs fine on when it lives on local host, but when I put the code on our prodution server it cannot find the filenames listed by user.

For example if I use the upload control to browse to B:MISCH IntiveRPTTOFL_3.csv and the code lives on my localhost which know what that file path means it works, but if the code is moved to a production server it may or maynot know what B:/ is or B:/ maybe mapped to something else. Even if I am browsing to a file on my C drive it will work on if the code is on the machine that the C drive is on, but it will not work if the code is on another machine because obviously that file wouldnt be on that C drive.

Private Function CSV2DataTable(ByVal filename As String) As DataTable

Using MyReader As New _
Microsoft.VisualBasic.FileIO.TextFieldParser(filename)
MyReader.TextFieldType = FileIO.FieldType.Delimited

What can I do in asp.net to make the filename work correctly?

Ok lets say I get the filename and save it as so

FileUploadControl.SaveAs(Server.MapPath("~/") + filename);

now I want to pass the filename to the function above for processing. Do I pass Server.MapPath("~/") + filename as the filename? Also when I am done what do I do to delete the file from the server?

View 1 Replies

Web Forms :: Getting .aspx File Paths?

Jul 14, 2010

Is it possible to scan all .aspx files in a web-site directory ? Suppose that , i've a home page like home.aspx, and many other pages.

How can i list all other pages with hyperlinks ?

View 3 Replies

Web Forms :: Image Paths When Using Routing

Jan 24, 2013

I have implement url routing on my website project in vs 2010 and IIS 7.

But after implemented I have facing issue where images and css some times load and some not.

View 1 Replies

Web Forms :: Set Local And Remote Paths Automatically

Jan 21, 2010

I'm developing an ASP.NET Website locally using Web Developer Express Edition and publish my site via ftp to the remote host. Problem: Locally I'm using path settings to xml files etc. different from the remote paths. So each time before I publish my site I have to set the remote paths explicitely commenting out the specific lines of code.

Sample:

if(local) {
XDocument loaded =
XDocument.Load(@"<localpath>jobitemssample_" + companyId +
".xml");
else{
XDocument loaded =
XDocument.Load(@"<remotepath>datajobitemssample_" + companyId + ".xml");
}

How can I achieve an automatic setting mechanism on deployment. How do I know how to set local?

View 2 Replies

Web Forms :: SiteMap With Multiple Paths To Same Page?

Jul 20, 2010

I have a sitemap, and i'm using nested repeaters to display the parent and child nodes for my breadcrumbs.I have 3 pages: Home, Hub, and Search.Each of these pages can navigate to each other. In other words:

Home> Hub
Home> Search
Home> Hub > Search
Home> Search > Hub
Home > Default

The most common path would be "Home > Hub" and Home > Search > HubHowever, I can't seem to figure out how to show this on my breadcrumbs, since you can't have multiple ULR's in the Sitemap. Right now, you can only go "Home > Hub". If you go from "Search" to "Hub...it should show "Home > Search > Hub" in the breadcrumbs.

View 5 Replies

Multiple Paths In Location Element Of Web.config?

Dec 20, 2010

How to specify multiple paths in one location element in web.config:, a

<location path="Images">
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
</location>

We would like to add styles and images to location, e.g. location path="images, styles". Is it possible to put multiple paths in location element (and how)?

View 2 Replies

URL Rewrite Breaks Root Relative Paths?

Jan 27, 2011

I have a website, lets call it mywebsite.com. I also have a blog at mywebsite.com/blog. I have made a URL rewrite rule so it can be accessed from blog.mywebsite.com. The issue is that all my root relative paths (~/) do not work when viewing the blog from blog.mywebsite.com. Ok, say if there is a link on my blog that goes to a blog post that is at ~/blog/post.aspx?id=1. It will then go to blog.mywebsite.com/blog/post.aspx?id=1 which is actually, mywebsite.com/blog/blog/post.aspx?id=1 and that does not exist.

View 3 Replies

Localization :: Change Image Paths Programmatically?

Sep 16, 2010

I am working on a localization project, some of the localized text are in graphics, some of the example graphics paths:

/en/images
/es/images
/fr/images

My web forms use <asp:image> controls and <img> tags (runat = sever) to point to graphics in /en/images. I need to a function to loop through all image control and point them to different paths based on the locale set at runt time. Which event should I override and how do I write it?

All my web pages inherit from a base page, I don't know if that makes differences.

View 5 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

Stream Filter To Alter Paths Of Images?

Jan 9, 2011

I am looking to write a stream filer in a http module that anyalyze the output html of a page, search through the pages html for any images within the page, check if the source of the image has a full path or relative path. If its a relative path, alter it to have a full path. Anyone ever write anything anything like this? Looking for some examples of such?

View 1 Replies

Wrong Root, Absolute Paths '~' Don't Work?

Aug 24, 2010

have some kind of strange problem. I use Visual Studio 2008 Standard Edition, and whenever I use ~ in links (like PostBackUrl = "~/Admin/AddProduct.aspx"), ~ is translated into "C:DocumentAndSettingsUserDesktop" instead of my application root. Of course I dont have any project on Desktop. It happens in every project I run , even in project from pendrive which works properly on other computers.How can i solve this problem ? What and where should i change ?

View 8 Replies

MVC :: Site.master Image Paths Change?

Mar 3, 2010

I have a problem with my paths.hen I look at the default page that has my logo on the site.master the image (on site.master) shows fine in my browser:http://localhost:50033/Img/Logos/ahn_logo.pngAs soon as I click on a link like "About Us" the view gets returned but the image path is now:http://localhost:50033/Home.aspx/Img/Logos/ahn_logo.pngand it does not show.Why does the path of the master page image change ?

View 3 Replies

C# - Automatically Create Directories From Long Paths?

Oct 27, 2010

I have a collection of files with fully qualified paths (root/test/thing1/thing2/file.txt). I want to foreach over this collection and drop the file into the location defined in the path, however, if certain directories don't exist, I want them to great created automatically. My program has a default "drop location", such as z:/. The "drop location" starts off empty, so in my example above, the first item should automatically create the directories needed to create z:/root/test/thing1/thing2/file.txt. How can I do this?

View 5 Replies

SQL Server :: Table Cause Cycles Or Multiple Cascade Paths?

Oct 4, 2010

i have a table that contains 3 forign keys, 2 of them from the same table when i make Delete Rule Cascade,this error message appears

'Customers' table saved successfully
'Order' table
- Unable to create relationship 'FK_Order_Customers1'.

Introducing FOREIGN KEY constraint 'FK_Order_Customers1' on table 'Order' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Could not create constraint. See previous errors. what is solution,as i want when i delete data from master table ,all dependent (child) data automatically deleted, so i use Cascade.

View 2 Replies

MVC :: Desparate - Jquery And Jqgrid - Javascript Paths On Development Vs. IIS?

Mar 11, 2011

I am at my wits end. I am developing an MVC application using the VS2010 templates and have added jquery and jqgrid functionality to my pages.

Everything works perfectly when running my app in debug mode using the Visual Studio Development web server. At runtime, the app comes up in the browser with a URL such as :

http://localhost:49572/

However, this app has functions that must run under HTTPS and accept client certificates so I've reconfigured the project to use IIS, configured the virtual directory, loaded a self-signed certificate, etc etc.

The app launches just fine with a URL that looks like this (depending on whether it is configured to launch with https or not).

http://machinename/virtualdirectory or https://machinename/virtualdirectory

but now my javascript and CSS references don't work. I've played around with every variation of ../file, ../Scripts/file.js, ../../Scripts/file.js, ../../Content/file.css. I've tried all the various helpers like ResolveClientUrl and Content.Url, leading ~, etc etc etc.

With some variations, certain jquery functions will work, like an Autocomplete text box or datepicker, but the jqgrid won't. If I leave everything at ../../Scripts/file.js, then all my jquery breaks running from IIS.

My CSS and link references look like this.

<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<link href="../../Content/themes/smoothness/jquery-ui-1.8.9.custom.css" rel="stylesheet" type="text/css" />
<link href="../../Content/themes/ui.jqgrid.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui.min.js" type="text/javascript"></script>
<script src="../../Scripts/grid.locale-en.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.jqGrid.min.js" type="text/javascript"></script>

View 1 Replies







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