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

ASP.NET

 
GeneralRe: Feedback form on my website to email feedback Pin
F-ES Sitecore22-Feb-16 22:31
professionalF-ES Sitecore22-Feb-16 22:31 
QuestionProblem ASP.NET MVC in IIS, RedirectToAction() and Redirect() Pin
Viadi21-Feb-16 3:48
Viadi21-Feb-16 3:48 
AnswerRe: Problem ASP.NET MVC in IIS, RedirectToAction() and Redirect() Pin
2374121-Feb-16 5:31
2374121-Feb-16 5:31 
QuestionI want to scan barcode for product management Pin
Anh Tuấn19-Feb-16 17:53
Anh Tuấn19-Feb-16 17:53 
AnswerRe: I want to scan barcode for product management Pin
aarif moh shaikh19-Feb-16 20:48
professionalaarif moh shaikh19-Feb-16 20:48 
GeneralRe: I want to scan barcode for product management Pin
Anh Tuấn19-Feb-16 20:54
Anh Tuấn19-Feb-16 20:54 
AnswerRe: I want to scan barcode for product management Pin
Richard MacCutchan19-Feb-16 23:34
mveRichard MacCutchan19-Feb-16 23:34 
QuestionMCV How To? Controller Action that doesn't do anything Pin
Foothill19-Feb-16 10:03
professionalFoothill19-Feb-16 10:03 
I'm having a hard time finding anything on this on the internet possible because I don't how to word the question properly.

So I'm reading the Chapter on Routing in Professional ASP.NET MVC 5 and on the second page they have a list of requirements for high-quality URLs. One bullet point is that a URL must be hackable, that is the end of the URL can be hacked off and still work. So I am currently adding handling for this into the controllers of a test project but I can't figure out how to do something.

For example, say I have a controller
C#
public class DepartmentController : Controller {}

With a Details action
C#
public ActionResult Details(int? id)
{
  // do something
}

I did figure out out that by making the parameter nullable, the controller doesn't error when passed a URL like: http://www.somesite.com/Department/Details that is lacking a parameter therefore fulfilling the hackable requirement. My question is on handling it.

All of the examples I can find pretty much mirrors this:
C#
public ActionResult Details(int? id)
{
  if (id == null)
  {
    return RedirectToAction("FourOhFourError", "Errors", null); // redirect to a resource not found page
  }
  else
  {
    // do something
  {
}

What I would like to know how to do is to return nothing. Is there a way not to return a redirect or is that impossible with an HTTP GET (i.e. the server must return something to the client)?


I found this which, turns out, is the same as returning null:
C#
return new EmptyResult();

but this just redirects the browser to an empty page. Is there a way to not do anything and have the browser stay on the same page or is that not how the HTTP protocol works?
if (Object.DividedByZero == true) { Universe.Implode(); }

AnswerRe: MCV How To? Controller Action that doesn't do anything Pin
Richard Deeming19-Feb-16 11:03
mveRichard Deeming19-Feb-16 11:03 
GeneralRe: MCV How To? Controller Action that doesn't do anything Pin
Foothill19-Feb-16 11:13
professionalFoothill19-Feb-16 11:13 
GeneralRe: MCV How To? Controller Action that doesn't do anything Pin
Richard Deeming20-Feb-16 3:56
mveRichard Deeming20-Feb-16 3:56 
AnswerRe: MCV How To? Controller Action that doesn't do anything Pin
2374121-Feb-16 5:29
2374121-Feb-16 5:29 
GeneralRe: MCV How To? Controller Action that doesn't do anything Pin
Foothill21-Feb-16 5:38
professionalFoothill21-Feb-16 5:38 
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 
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 

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.