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. redirect from a cs fiel?

redirect from a cs fiel?

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-netdesignhelp
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.
  • S Offline
    S Offline
    Snowjim
    wrote on last edited by
    #1

    Hey I have an ASP.NET application with a DBConnection.cs(public class DBConnection : System.Web.UI.Page) file! This class is used by other aspx pages. When an error accures in the DBConnection.cs I want my errorMessage.aspx to be displayd with my error message(Session["ErrorMessage"] = errorstring;) When i try Response.Redirect("ErrorPage",false); it says that this method is not available in this context? How do i solve this the nice way? or shold i just use delegates so the aspx page is redirecting instead? Best Regards Jimmy

    T 1 Reply Last reply
    0
    • S Snowjim

      Hey I have an ASP.NET application with a DBConnection.cs(public class DBConnection : System.Web.UI.Page) file! This class is used by other aspx pages. When an error accures in the DBConnection.cs I want my errorMessage.aspx to be displayd with my error message(Session["ErrorMessage"] = errorstring;) When i try Response.Redirect("ErrorPage",false); it says that this method is not available in this context? How do i solve this the nice way? or shold i just use delegates so the aspx page is redirecting instead? Best Regards Jimmy

      T Offline
      T Offline
      Thang T
      wrote on last edited by
      #2

      Hi, for example, if your class is used by errorpage.aspx. then you view the write to session("errorMessage") in the errorpage.aspx Then, when the error occurs, we call Response.redirect("errorpage.aspx") to redirect to the errorpage to show the error message in which you have saved in Session("errorMessage") Ich liebe .NET :)

      S 1 Reply Last reply
      0
      • T Thang T

        Hi, for example, if your class is used by errorpage.aspx. then you view the write to session("errorMessage") in the errorpage.aspx Then, when the error occurs, we call Response.redirect("errorpage.aspx") to redirect to the errorpage to show the error message in which you have saved in Session("errorMessage") Ich liebe .NET :)

        S Offline
        S Offline
        Snowjim
        wrote on last edited by
        #3

        Hey! Yes its like that i whant it to work, but when i try to cal the Response.redirect in my DBConnection.cs (Regular C# class) then it says that this action is not valid in that context. Do i have to make my DBConnection to a aspx form to be abled to use Response.redirect? Or is there a way to redirect to a aspx page from a cs(regular C# class) ?? //Jimmy

        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