Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

My link to http handler is requiring me to use /...../xxx.ashx in my link????

Posted on 2012-03-16
3
314 Views
Last Modified: 2012-03-20
<link href='/httphandlers/GetCustomCSS.ashx' rel='stylesheet' type='text/css' />
           
I'm using the link above to access a http handler that I wrote and is located in my mvc folder under /httphandlers/...
 
I don't understand why I have to use the path /httphandlers/getCustomCSS.ashx to access this but, if I don't - I get a 404 not found.
The web config has it registered correctly as:  <add name="GetCustomCSS" path="GetCustomCSS.ashx" verb="GET" type="Portal.HttpHandlers.GetCustomCSS"  />
     
I should be able to link to this using:

<link href='GetCustomCSS.ashx' rel='stylesheet' type='text/css' />

but I cannot get this to work... It is just a minor issue but, I just don't understand why this is the case.  Every example I see, does not require you to use a path, after you register the mapping... so what is up?  Is it because the handler is contained in the httphandles folder of the mvc app? or what?
0
Comment
Question by:jparlato
  • 2
3 Comments
 

Author Comment

by:jparlato
ID: 37730161
It also is working if I use:

<link href='/GetCustomCSS.ashx' rel='stylesheet' type='text/css' />

Again, I don't know whaty the / is being required ....
Shouldn't it work with just:

<link href='GetCustomCSS.ashx' rel='stylesheet' type='text/css' />
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 37732069
if you use a relative path (no / at beginning) your file GetCustomCSS.ashx needs to be in the same directory as the file requesting it
if it is a virtual directory, your container configuration needs to be fonfigured proper
0
 

Author Comment

by:jparlato
ID: 37735737
Ok, but what is the point of registering this as follows:
<add name="GetCustomCSS" path="GetCustomCSS.ashx" verb="GET" type="Portal.HttpHandlers.GetCustomCSS"  />  
since this is MVC all .cs files should be compiled into the bin/assembly, right?  Why doesn't it find this namespace in the assembly.  I guess you may be correct, but do you know why it confuses me that I give this namepace, only to have to then give a path to find what is a .cs file... that should be compiled... Just want to understand what is going on.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question