Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Response.Redirect problem

Response.Redirect problem

Scheduled Pinned Locked Moved ASP.NET
asp-nethelpcsharparchitecturequestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Quake2Player
    wrote on last edited by
    #1

    Hi, I'm using ASP.net MVC, In a certain controller ("Users") I have a "LoginNeeded()" method, this one redirects you if you are not logged in: if (CurrentUser == null) { HttpContext.Response.Redirect("/Users/Login/", true); } The problem: If a method from the Users controller calls this method.. everything works fine. If a method from another controller calls this method.. It doesnt find the action i'm redirecting (it tries to search in "Shared/Users/Login" and "ThisOtherController/Users/Login" Any help?!

    A 1 Reply Last reply
    0
    • Q Quake2Player

      Hi, I'm using ASP.net MVC, In a certain controller ("Users") I have a "LoginNeeded()" method, this one redirects you if you are not logged in: if (CurrentUser == null) { HttpContext.Response.Redirect("/Users/Login/", true); } The problem: If a method from the Users controller calls this method.. everything works fine. If a method from another controller calls this method.. It doesnt find the action i'm redirecting (it tries to search in "Shared/Users/Login" and "ThisOtherController/Users/Login" Any help?!

      A Offline
      A Offline
      Adam Maras
      wrote on last edited by
      #2

      Try instead HttpContext.Response.Redirect("~/Users/Login/", true);

      Adam Maras | Software Developer Microsoft Certified Professional Developer

      Q 1 Reply Last reply
      0
      • A Adam Maras

        Try instead HttpContext.Response.Redirect("~/Users/Login/", true);

        Adam Maras | Software Developer Microsoft Certified Professional Developer

        Q Offline
        Q Offline
        Quake2Player
        wrote on last edited by
        #3

        Doesnt work either...

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups