0

I'm trying to create a upload center application using Asp.Net MVC 4. I want to have a url like this : http://site.com/user/{username}/{path} and path is like this/dir1/subdir2/file.txt and I return it(or edit it or etc)

but I don't know how can I allow to have / character in url? because Mvc throws a security exception. can anybody Help me?

The directories aren't physical. I keep all files in one directory and save their's properties in DataBase

4
  • You should use Query strings instead. Your url will be like this: http://site.com/user/{username}/?path=/dir1/subdir2/file.txt Commented Aug 2, 2012 at 0:34
  • @MahdiGhiasi I want it without query string. Commented Aug 2, 2012 at 0:36
  • 1
    possible duplicate of File path as MVC route argument Commented Aug 2, 2012 at 0:49
  • @AlexeiLevenkov: I searched a lot but I didn't find it. thanks Commented Aug 2, 2012 at 0:59

1 Answer 1

2

The feature you are looking for is called "wildcard routing" (see duplicate File path as MVC route argument for more info).

  "http://site.com/user/{username}/{*path}"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.