Url in c# razor webpage


I want my page to have the urlstructure like this:
how does it work. It seems like there need to be a psyical file like:
where category and product is .cshtml files.
Jesper ChristensenProgrammerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kaufmed 👽Commented:
Are you writing a Web Forms or MVC application (or a Web Site project)?
Jesper ChristensenProgrammerAuthor Commented:
Web Site project
kaufmed 👽Commented:
Just to be absolutely sure:  When you say "Web Site", you created your project like this, yes?

OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Jesper ChristensenProgrammerAuthor Commented:
Yes :)
kaufmed 👽Commented:
Well Web Sites don't use the routing engine that MVC comes with, so they more or less work like traditional web pages. Short of writing your own custom module, or *maybe* importing one of the MVC modules, I think URL rewriting would probably be the easiest route to go. I would start at the official ASP.NET web site for more information:


The gist of it will be that you put your simplified URLs in your Razor--probably by hand rather than through the default helpers; or perhaps you can write a helper--and you set up your rewrites to manipulate these URLs into what the web server expects to see.
Jesper ChristensenProgrammerAuthor Commented:
Ok. I´ve tried in global asa, but gets an error:  
Mente du: Typen 'ASP.Page Default Cshtml' nedarves ikke fra 'System.Web.UI.Page'.
Type 'ASP._Page_default_cshtml' not inherited from 'System.Web.UI.Page'.

void Application_Start(object sender, EventArgs e)

    void RegisterRoutes(RouteCollection routes)
        // redirects
        routes.MapPageRoute("hello", "hello", "~/default.cshtml");
kaufmed 👽Commented:
I don't think that will work because you're attempting to mix MVC and Web Site architectures. It may, but I wouldn't know where to begin in order to make it work. Someone else might.
Jesper ChristensenProgrammerAuthor Commented:
Ok. So it´s not possible to make the routes to files in folders?
It only work if the name is a file in main path?
kaufmed 👽Commented:
I'm saying that I don't believe you can use anything to do with routes because you are not working in an MVC project.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.