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. Page does not redirect

Page does not redirect

Scheduled Pinned Locked Moved ASP.NET
csharphelphtmlasp-net
3 Posts 3 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.
  • I Offline
    I Offline
    imranafsari
    wrote on last edited by
    #1

    Dear all, I am using asp.net2.0, C#, ajax1.0 Now there is requirement where I have to check user where he has access to this side it not then show the message and return to default page Now I am trying with this code Define a method in a class as public void ShowMsg(string msg, Page p) { String csname1 = "PopupScript"; Type cstype = this.GetType(); String cstext1 = "alert(' " + msg + "');"; ScriptManager.RegisterClientScriptBlock(p, cstype, csname1, cstext1, true); } then call this method as Doctor drck = new Doctor(); drck.ShowMsg("Access denied", this.Page); and redirect it as Response.Redirect("~/HTML/writeup.aspx"); Now issue is page does not redirect to specified path if I comment message then page redirect What problem with the code If any better idea, please suggest Thank you imran khan

    A W 2 Replies Last reply
    0
    • I imranafsari

      Dear all, I am using asp.net2.0, C#, ajax1.0 Now there is requirement where I have to check user where he has access to this side it not then show the message and return to default page Now I am trying with this code Define a method in a class as public void ShowMsg(string msg, Page p) { String csname1 = "PopupScript"; Type cstype = this.GetType(); String cstext1 = "alert(' " + msg + "');"; ScriptManager.RegisterClientScriptBlock(p, cstype, csname1, cstext1, true); } then call this method as Doctor drck = new Doctor(); drck.ShowMsg("Access denied", this.Page); and redirect it as Response.Redirect("~/HTML/writeup.aspx"); Now issue is page does not redirect to specified path if I comment message then page redirect What problem with the code If any better idea, please suggest Thank you imran khan

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      use session... to store your message, and after redirecting, you need to show the message from session to the document. If you are writing the alert on the same page, it will not work. Rather you can call alert in writeup.aspx. Its better practice

      Abhishek Sur

      1 Reply Last reply
      0
      • I imranafsari

        Dear all, I am using asp.net2.0, C#, ajax1.0 Now there is requirement where I have to check user where he has access to this side it not then show the message and return to default page Now I am trying with this code Define a method in a class as public void ShowMsg(string msg, Page p) { String csname1 = "PopupScript"; Type cstype = this.GetType(); String cstext1 = "alert(' " + msg + "');"; ScriptManager.RegisterClientScriptBlock(p, cstype, csname1, cstext1, true); } then call this method as Doctor drck = new Doctor(); drck.ShowMsg("Access denied", this.Page); and redirect it as Response.Redirect("~/HTML/writeup.aspx"); Now issue is page does not redirect to specified path if I comment message then page redirect What problem with the code If any better idea, please suggest Thank you imran khan

        W Offline
        W Offline
        www Developerof NET
        wrote on last edited by
        #3

        Use javascript to redirect instead of using response.redirect for eg.. Sub Show_Msg() Dim scp As String = "alert('Access denied ');window.location.href='~/HTML/writeup.aspx'" ClientScript.RegisterClientScriptBlock(Me.GetType(), "script1", scp) End Sub I am not sure whether the "~" sign works in javascript or no.You might have to change it accordingly.

        When you fail to plan, you are planning to fail.

        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