Web Forms :: URL Routing - Local Files Become Inaccessible

Dec 22, 2010

I am using URL Routing in Asp.net 4. I have successfully got the url routing working, however i have encountered a problem with my web pages trying to access local files. For e.g. before i started using URL Routing, my web page was called [URL]. In this page i was making references to a CSS file and some Js files. They were referenced as follows : <link href="CSS/mycss.css" rel="stylesheet" type="text/css" /> and <script src="js/myjs.js" type="text/javascript"></script>. So basically i have two folders sitting on the route, called CSS and JS, containing the respective files.

However, after implementing routing my url has now become e.g. [URL] This is fine, but what has now happened is that my CSS and JS have become inaccessible as they are now referenced as follows: [url] or [url] i know i can sort of resolve this by referencing my files as follows

<link href="../../../CSS/mycss.css" rel="stylesheet" type="text/css" />
and <script src="../../../js/myjs.js" type="text/javascript"></script>.

But that means i have to change the path for every reference, and i have too many. Then also i must change the references to any background images for instance in my css to have the same path. This is a huge nuisance, and pain in the back side. Does anybody know of a solution for this, where i will not need to change the referencing for the files.

View 6 Replies


Similar Messages:

C# - Application Finds Local Resource Files In Web Development Server But Not Local IIS

Sep 22, 2010

When I run the application using the Web Developer it works fine. However when I run it using local IIS I get the following error:

The resource class for this page was not found. check if the resource file exists and try again. Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The resource class for this page was not found. heck if the resource file exists and try again.

Source Error:

Line 81: private void PopulateLanguageList()
Line 82: {
Line 83: DropDownListLanguage.Items[0].Text = (string)HttpContext.GetLocalResourceObject(
Line 84: "Default.aspx", SelectLanguage, Thread.CurrentThread.CurrentCulture);
Line 85: }

Stack Trace:

[InvalidOperationException: The resource class for this page was not found. Please check if the resource file exists and try again.]
System.Web.Compilation.LocalResXResourceProvider.CreateResourceManager() +4038050
System.Web.Compilation.BaseResXResourceProvider.EnsureResourceManager() +23
System.Web.Compilation.BaseResXResourceProvider.GetObject(String resourceKey, CultureInfo culture) +24
System.Web.Compilation.ResourceExpressionBuilder.GetResourceObject(IResourceProvider resourceProvider, String resourceKey, CultureInfo culture, Type objType, String propName) +32
System.Web.HttpContext.GetLocalResourceObject(String virtualPath, String resourceKey, CultureInfo culture) +56
APPortal.Login.PopulateLanguageList() in c:inetpubwwwrootAPPortalDefault.aspx.cs:83
APPortal.Login.Page_Load(Object sender, EventArgs e) in c:inetpubwwwrootAPPortalDefault.aspx.cs:20
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
System.Web.UI.Control.OnLoad(EventArgs e) +132
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428

View 1 Replies

When Publish Website To Local Folder And Access On Local Pc, Java Script Files Did Not Work

Mar 29, 2011

I created a website using VS2010. When I run the website using built-in web server, everything works fine. The website recognizes javascript and aurigma uploader. When I publish the website to local folder and tried to access using IIS 5.1 on local pc,
the java scipt files did not work. I was getting yellow triangle sign at the bottom of the page indicating the object is expected. I tried to look online but i could not find any answer. I have included jquery and javascript file in the header section of master

View 3 Replies

MVC Routing For Files With Muliple Sub-directories?

Aug 18, 2010

I need to setup a file handler to route with multiple sub directories something like tihs;

http://localhost/images/7/99/786936215595.jpg

I tried putting this in the global.asax file;

routes.Add(
"ImageRoute",
new Route("covers/{filepath}/{filename}",
new ImageRouteHandler()));

I am using the ImageHandler found in this Question, which works great if you have a single sub-directory (ie '/images/15/786936215595.jpg') but fails when you have multiple directories.

I tried setting up a wildcard and that didnt work (ie 'new Route("covers/{filepath}/*/{filename}"')

This is serving images from a large NAS (think something like 3 million images) so its not like I can just move files around.

View 2 Replies

MVC :: Routing Not Ignoring Files That Exist On Disk?

Feb 21, 2011

I am testing with an MVC 2 project generated by the template in VS 2010. I have simply added an ADO.NET Entity Data Model, as well as a WCF Data Service that leverages the data model.

I was able to access the web application content (views, as well as the data served by the data service) just fine until the day before yesterday.

Yesterday I decided to reinstall Windows 7 on my development laptop, and I chose to go with the release of the OS with SP1. Of course, I reinstalled Visual Studio as well.

Now the same project gives me HTTP 404 errors when I try to browse to the data url .../MyTodoDataService.svc).

Here are some interesting facts:

The same data service works just fine in a Web Forms application. I see the problem only when deploying to the Local IIS Web Server (Cassini runs it just fine).

I am able to browse to the data url if force MVC routing to ignore the appropriate route by calling "IgnoreRoute" on the RouteCollection in Global.asax.

View 7 Replies

C# - Block Access To Files When Using The System.Web.Routing.UrlRoutingModule?

Jan 22, 2010

I'm using the System.Web.Routing.UrlRoutingModule.

With that I'm writing:

routes.Add(new Route(@"cart/add", new RouteHandler("~/Order/CartAdd.ashx")));
routes.Add(new Route(@"cart/delete", new RouteHandler("~/Order/CartDelete.ashx")));

And I also have one route called:

routes.Add(new Route(@"{*url}", new RouteHandler("~/Error/PageNotFound.ashx")));

But if I go directy to /Order/CartAdd.ashx I never enter the routing. It goes directly to that handler. And if I go to /Order/ I get a 403.14 error.

How do I instead catch those urls with the routing?

View 1 Replies

Security :: URL Routing Doesn't Work For Files In Admin Folder

Jun 24, 2010

I am using URL routing in asp.net application (not MVC) . I have Admin folder in my aaplication which has admin related aspx pages with seperate web.config. I have seperate login form for admin users which is placed in admin folder itself. My issue is whenever I hit [URL] (which I want to go to login form for admin)- it tries to authenticate and goes to login url mentioned in web.config of root folder.

Note: Admin folder has anonymous access in root config file. Also I have set default document in config of Admin folder. I have added following line in global.asax so that routing doesnt work for files in admin folder;

routes.Add(new
Route("admin/{*resource}",
new
StopRoutingHandler()));

I am really confused what is the issue? What I am missing?

View 6 Replies

Web Forms :: HfCount Is Not Declared - It May Be Inaccessible Due To Its Protection Level

Jul 17, 2015

With reference to the following link: [URL] ....

I have some challenge with "hfCount" which can be found in SetData function and btnDelete of the above link. The error i get is: hfCount is not declared. It may be inaccessible due to its protection level. it works on Visual Studio 2010 but gives the above error in Visual Studio 2012 ...

What could be the problem?

View 1 Replies

How To Access Client's Local Files

Jun 24, 2010

it should be in asp.net. but, it is urgent and important, wish someone here know the answer.

what I need do for an asp.net page is:

1) client select a file, or;
2) client select a folder;

Get file (or files in the folder)'s properties, something like name, ext, etc. and save to db.

it will be easy if it is a desktop app. however, in asp.net, how can I do that? do I have to upload all files to server first? is there a way to do this for all files in a folder? any third party control?

View 7 Replies

Access Client's Local Files?

Jun 24, 2010

what I need do for an asp.net page is:

1) client select a file, or;

2) client select a folder; Get file (or files in the folder)'s properties, something like name, ext, etc. and save to db.

it will be easy if it is a desktop app. however, in asp.net, how can I do that? do I have to upload all files to server first? is there a way to do this for all files in a folder? any third party control?

View 3 Replies

Forms Data Controls :: Gridviewroweventargs Is Inaccessible Due To Its Protection Level?

Jul 1, 2010

I have a problem, with a gridview. When I try to make a OnRowDataBound I get the error "Gridviewroweventargs is inaccessible due to its protection level" I cann't figure out why.My aspx code for the gridview:

[Code]....

Now I have comment out everything in the function grdWaitingApproval_RowDataBound:

[Code]....

When I remove the line in the aspx file

[Code]....

the project runs fine and I get a list of users with username date and so on. But I nead to use the RowDataBound to select a picture to each row.

View 1 Replies

Downloading Files From The Server To The Local Machine In C#?

Jul 24, 2010

In my application I have a requirement where the client/user needs to download video files from the server to their local machine.

View 1 Replies

Web Forms :: Web.Routing Doesn't Work On Server On IIS Routing

Jul 20, 2010

I tried everything I could find, but still does not work on IIS routing.

View 2 Replies

Web Forms :: Repeater Error - Container Is Not Declared / It May Be Inaccessible Due To Its Protection Level

May 7, 2015

I tried like this but getting an error "container is not declared, It may be inaccessible due to it's protection level"

HTML

<div style="width: 100px">
<br />
<hr />
<br />
<asp:Repeater ID="rptLeftMenu" runat="server" EnableViewState="false">
<ItemTemplate>
<%-- <asp:HyperLink ID="hypLeftMenu" Font-Bold="true" runat="server" NavigateUrl='<%#Eval("Url")%>'><%#Eval("text")%> </asp:HyperLink>--%>

[Code] ....

View 1 Replies

Is C# Code Intended To Read Local Client Files

Sep 16, 2010

is this c# code intended to read local client files?System.IO.FileStream content = System.IO.File.Open("c: est.txt", System.IO.FileMode.Open);It gives me error FILE NOT FOUND

View 2 Replies

How To Create The Proxies From Wsdl Files On Local Machine

Mar 16, 2011

I have a web service I need to connect to. But when trying to connect to it through visual studios, I get this error. The request failed with HTTP status 405: Method Not Allowed. I have the wsdl files on my location machine. I was told to create the proxies from these. The problem is I'm not quite sure how. This seems to be a little over my head right now. Not the best project to learn WCF or WSE on. Does anyone know how to create the proxies from wsdl files on my local machine. The services themselves are pretty simple, they just have security elements in the headers. UsernameToken. And then some custom fields.

View 1 Replies

Making Hide / Show Files And Folders In Local System?

Dec 8, 2010

I am tring to hide a image in local folder by asp.net. How to get this.

send me a sample code ,I tring that filename.attributes.hidden

View 3 Replies

Routing With Web Forms - Could Not Load System.Web.Routing

Dec 12, 2010

I am using:

ASP.NET 3.5 SP1 with Web Forms Routing thru Global.asax (System.Web.Routing and RegisterRoutes)IIS 7

Everything is working fine in my local machine, but it gives the following error in my hosting environment:

Could not load file or assembly 'System.Web.Routing, Version=3.5.0.0, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I did everything inside my web.config file mentioned in the following link:

[URL]

But I am still getting the above error.

What else am I supposed to do fix the error?

View 1 Replies

AJAX :: How To Avoid After Viewed Online Pdf Document Storing In Local Temporary Internet Files

Jun 29, 2010

I want to show my online pdf document to client (like e-paper PDF document display.)

But after display the online pdf document to client then the document will be store on client Temporary Internet Files.

How to avoid storing in local Temporary Internet Files after viewed online pdf document in asp.net?

I want to secure my pdf document ?

Any possibility to avoid storing PDF documents in local Temporary Internet Files?

View 1 Replies

Relative Urls For Images And Js Files In MVC Application - Diff Behaviour On Local And Production Server?

Mar 13, 2011

I have an MVC web application, the urls like following in my views folder:

<img src="../../Images/Delete.png"/>

are working on my localhost, but when I deployed the application on production server, they stopped working and when I use single ".." instead of double "../.." , they start working on production server.

View 2 Replies

Rest WCF Url Routing & Web Forms Routing?

Feb 22, 2011

I have a Web application where i have added a reference to a RESTful WCF. I got the WCF url Routing to work in my webapplication by adding Inherits="RestService.Global" to the Web applications Global.asax.

<%@ Application Codebehind="Global.asax.cs" Inherits="RestService.Global" Language="C#" %>

But then i tried to create url Routing for the Web application and it does not work with the Inherits="RestService.Global" in the Global.asax. If i take it away it works fine. Is there a correct way to do this.

View 1 Replies

Web Forms :: URL Routing And Dynamic Routing?

Jan 31, 2011

I'm trying to create my own CMS and I've gotten a little bit stuck at the stage of URL routing.

I want clean URLs without extensions and I'd like to be able to create and modify them in a web based interface without any messing around with IIS or actual files.

I've seen how to create a static route, but for that I need to go into my Global.asax file and manually add it.I would like to have all of these routes stored in a database so that I can easily modify them later.

Does anyone know how this can be achieved?

Just for extra information, I will be attempting to create a feature so that if a path exists, but is later changed, a 301 redirect is created to the new URL, is this also possible? (My first problem is the main issue, but thought I might ask this as well just in case it makes a difference)

View 2 Replies

Security :: Some Wizard Steps Inaccessible From Code Behind?

Sep 28, 2010

I have a CreateUserWizard with three Wizard steps and one CreateUserWizardStep. The first two are accessible from the code behind by ID. The third and fourth are not! If I comment out the references to these two steps in the code behind the page runs fine. I have triple checked the variable names and everything is fine. Everything that should have a runat="server" does, everything is enabled, all of that good stuff.

why some steps in the same CreateUserWizard may not be visible from the code behind and others are?

View 3 Replies

'CreateDatabase.SqlHelper' Is Inaccessible Due To Its Protection Level?

Apr 9, 2010

I have create a class SqlHelper in window console client project, then test it it works fine. In my SqlHelper class I make all methods are public static. Then I created an assembly, add it to my unit testing project. Whne I try to access the public function of SqlHelper class, I got error like "Error 1 'CreateDatabase.SqlHelper' is inaccessible due to its protection level ".

Here is my class:

[Code]....

at this line: SqlHelper.setUpTestDatabase I got above error, Where goes wrong?

View 2 Replies

AJAX :: UpdatePanel: Controls Inside Are Now Inaccessible?

Aug 25, 2010

I had a group of controls. They were programmatically referenced so that I could change the text of the labels. It all worked well. So I just put an update panel in and put the controls [i]inside[/i] the UpdatePanel. Now the code that references these labels inside the update panel are no longer recognized. I imagine it's because they are inside the updatepanel now. But for some reason, the web application still works correctly, but the code is blotched up with errors every time a label inside the updatepanel is referenced. My question is, how do I programmatically reference the labels that are located inside the update panel?

View 4 Replies







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