Click here to Skip to main content
15,887,350 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: MCV How To? Controller Action that doesn't do anything Pin
2374121-Feb-16 5:50
2374121-Feb-16 5:50 
GeneralRe: MCV How To? Controller Action that doesn't do anything Pin
Foothill21-Feb-16 5:52
professionalFoothill21-Feb-16 5:52 
GeneralRe: MCV How To? Controller Action that doesn't do anything Pin
2374121-Feb-16 5:55
2374121-Feb-16 5:55 
AnswerRe: MCV How To? Controller Action that doesn't do anything Pin
Nathan Minier22-Feb-16 2:39
professionalNathan Minier22-Feb-16 2:39 
GeneralRe: MCV How To? Controller Action that doesn't do anything Pin
Foothill22-Feb-16 3:12
professionalFoothill22-Feb-16 3:12 
GeneralRe: MCV How To? Controller Action that doesn't do anything Pin
Nathan Minier22-Feb-16 3:53
professionalNathan Minier22-Feb-16 3:53 
GeneralRe: MCV How To? Controller Action that doesn't do anything Pin
Foothill22-Feb-16 4:10
professionalFoothill22-Feb-16 4:10 
GeneralRe: MCV How To? Controller Action that doesn't do anything Pin
Nathan Minier22-Feb-16 4:31
professionalNathan Minier22-Feb-16 4:31 
Well, the fact is this behavior breaks the expected functionality of HTTP; the appropriate response by convention would be to return an HttpNotFound() if the id is not set or null, or send down a view with a list of possible values.

Generally the expected behavior for HTTP is to send a request and get a response of some sort. Black-holing the response is just not the norm.

All that said, I wasn't in on the meetings where they defined the standards that were going into MVC (it'd hopefully be less cluttered if I was Big Grin | :-D )

And to answer your question, you're overthinking that. I went back and re-read your initial post and have a much better solution for you:
C#
DepartmentController.cs
{
   public ActionResult Details(int? id)
   {
      if(id == null)
      {
         return View("Home"); // Or "Index", or whatever your base view is called
      }
      // do something
   }
}

No new routes or anything needed.
GeneralRe: MCV How To? Controller Action that doesn't do anything Pin
Foothill22-Feb-16 4:59
professionalFoothill22-Feb-16 4:59 
QuestionHighlight text in the pdf. Pin
er.durgesh17-Feb-16 22:47
er.durgesh17-Feb-16 22:47 
QuestionNetTiers is creating Delete methods twice need some help Pin
indian14317-Feb-16 14:35
indian14317-Feb-16 14:35 
QuestionASP.Net VB: Dynamic refresh of webpage after completion of asynchronous task Pin
ajaysh7317-Feb-16 14:20
ajaysh7317-Feb-16 14:20 
Questioncascading with javascript Pin
Luis Oliveira 196617-Feb-16 5:40
Luis Oliveira 196617-Feb-16 5:40 
QuestionGridView behaving Strangely in an asp.net web page. Pin
Member 1221350616-Feb-16 7:08
Member 1221350616-Feb-16 7:08 
AnswerRe: GridView behaving Strangely in an asp.net web page. Pin
Richard Deeming16-Feb-16 7:27
mveRichard Deeming16-Feb-16 7:27 
GeneralRe: GridView behaving Strangely in an asp.net web page. Pin
Member 1221350616-Feb-16 7:33
Member 1221350616-Feb-16 7:33 
QuestionHow to create a language translator in asp.net using c#? Pin
Raja Ganapathy16-Feb-16 2:15
Raja Ganapathy16-Feb-16 2:15 
AnswerRe: How to create a language translator in asp.net using c#? Pin
Richard MacCutchan16-Feb-16 3:15
mveRichard MacCutchan16-Feb-16 3:15 
Questionhave a problem in custom control with javascript Pin
Member 1207470715-Feb-16 18:57
Member 1207470715-Feb-16 18:57 
SuggestionRe: have a problem in custom control with javascript Pin
Kornfeld Eliyahu Peter15-Feb-16 20:06
professionalKornfeld Eliyahu Peter15-Feb-16 20:06 
QuestionTelerik TreeList Child Level Items are not retrievable by using FindItemByKeyValue method Pin
indian14312-Feb-16 16:53
indian14312-Feb-16 16:53 
Questionproper use of System.Web.HttpContext.Current.User Pin
jkirkerx12-Feb-16 12:56
professionaljkirkerx12-Feb-16 12:56 
AnswerRe: proper use of System.Web.HttpContext.Current.User [Not Solved but I get it now] Pin
jkirkerx13-Feb-16 13:53
professionaljkirkerx13-Feb-16 13:53 
SuggestionRe: proper use of System.Web.HttpContext.Current.User [Not Solved but I get it now] Pin
Richard Deeming15-Feb-16 2:26
mveRichard Deeming15-Feb-16 2:26 
GeneralRe: proper use of System.Web.HttpContext.Current.User [Not Solved but I get it now] Pin
jkirkerx15-Feb-16 7:15
professionaljkirkerx15-Feb-16 7:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.