Search code examples
urlvisual-studio-2012sharepointprojectashx

How to address the URL of an ashx file


I have successfully added a file, X.ashx and its components (.cs, and so forth) to a project.

The structure is like this:

Solution Z

Project Y

Folder Layouts

Subfolder also named Y

X.ashx

SO the website has an address http://generic/SitePages/Home.aspx for the main file

I would think that one would use something like

http://generic/Y/Layouts/Y/x.ashx as the URL

and I've tried various permutations,

but I cannot get it to work correctly.

Does anyone know how the folder structure maps to a URL?

I am using Visual Studio 2012 and this is for a SharePoint project.

Also, my particular project does NOT have a web.config due to the template used....

Does anyone know of a good downloadable project/template for this in VS2012. I've tried searching but most projects do not have such a template.

Thanks in advance!


Solution

  • assuming you deployed the .ashx file to the layouts folder in the 14 hive, then it should be this:

    http://yourdomain/SitePages/_layouts/Y/x.ashx
    

    or

    http://yourdomain/_layouts/Y/x.ashx
    

    The Layouts folder gets referenced as _layouts in the url