c# - Creating URL from area to application -


i have area called "admin".

i can upload images through admin. , love display them on public pages. ie: not area.

so have imagecontroller.

when following:

<img src="@url.action("view","image", new {id = 1})" /> 

it creates url in admin area follows:

/admin/image/view/1 

but controller within /controller folder not in area.

so want

/image/view/1 

how working both admin , other areas?

you should change image html tag to:

<img src="@url.action("view", "image", new { id = 1, area = "" })" /> 

this remove area part, refer route in mvc root.

you maybe insert line partial or displayfor template , pass in image id.


Comments