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 page in asp.net

redirect page in asp.net

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netdatabasetutorial
6 Posts 5 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.
  • Z Offline
    Z Offline
    ZeroOne8
    wrote on last edited by
    #1

    hello very one ;) i need some help or advice from the people , who have expert in asp.net this is my problem the url for example is http://localhost:2940/website/page.aspx?ID=1 when i change id to http://localhost:2940/website/page.aspx?ID=100000000000000000000000000000000000 i get error manege The conversion of the nvarchar value '20000000000000000000000000000000' overflowed an int column. i need if the ID dose not exist in database table , redirect the page to homepage thx all

    P A G S 4 Replies Last reply
    0
    • Z ZeroOne8

      hello very one ;) i need some help or advice from the people , who have expert in asp.net this is my problem the url for example is http://localhost:2940/website/page.aspx?ID=1 when i change id to http://localhost:2940/website/page.aspx?ID=100000000000000000000000000000000000 i get error manege The conversion of the nvarchar value '20000000000000000000000000000000' overflowed an int column. i need if the ID dose not exist in database table , redirect the page to homepage thx all

      P Offline
      P Offline
      Parwej Ahamad
      wrote on last edited by
      #2

      I believe you are converting this value into int type and it's exceeding the max size. So use Long type.

      Parwej Ahamad

      1 Reply Last reply
      0
      • Z ZeroOne8

        hello very one ;) i need some help or advice from the people , who have expert in asp.net this is my problem the url for example is http://localhost:2940/website/page.aspx?ID=1 when i change id to http://localhost:2940/website/page.aspx?ID=100000000000000000000000000000000000 i get error manege The conversion of the nvarchar value '20000000000000000000000000000000' overflowed an int column. i need if the ID dose not exist in database table , redirect the page to homepage thx all

        A Offline
        A Offline
        AditSheth
        wrote on last edited by
        #3

        there is 2 way to handle this issue 1) increase the size of Column of id in database 2) before executing query for existing of id check length of ID if it is less then the column size then go ahead. else return false from there no need to execute query. I prefer to use 2nd method. Remember one thing that when you execute sql query always check length of fields which you are using in query. :) Thanks

        As our case is new, we must think and act a new. Abraham Lincoln

        1 Reply Last reply
        0
        • Z ZeroOne8

          hello very one ;) i need some help or advice from the people , who have expert in asp.net this is my problem the url for example is http://localhost:2940/website/page.aspx?ID=1 when i change id to http://localhost:2940/website/page.aspx?ID=100000000000000000000000000000000000 i get error manege The conversion of the nvarchar value '20000000000000000000000000000000' overflowed an int column. i need if the ID dose not exist in database table , redirect the page to homepage thx all

          G Offline
          G Offline
          GenJerDan
          wrote on last edited by
          #4

          In the Page_Load event...

          [put code to check if ID is valid here, then. . .]

          If (NotValid)
          {
          Server.Transfer("Default.aspx");
          }
          else
          {
          DoAllTheNormalStuff();
          }

          Just like that old Carly Simon song... "You're so funny, You probably think this joke is about you" My Mu[sic] My Films My Windows Programs, etc.

          Z 1 Reply Last reply
          0
          • G GenJerDan

            In the Page_Load event...

            [put code to check if ID is valid here, then. . .]

            If (NotValid)
            {
            Server.Transfer("Default.aspx");
            }
            else
            {
            DoAllTheNormalStuff();
            }

            Just like that old Carly Simon song... "You're so funny, You probably think this joke is about you" My Mu[sic] My Films My Windows Programs, etc.

            Z Offline
            Z Offline
            ZeroOne8
            wrote on last edited by
            #5

            thank u all that is not relay what i want put it is okay i fix it thank all again

            1 Reply Last reply
            0
            • Z ZeroOne8

              hello very one ;) i need some help or advice from the people , who have expert in asp.net this is my problem the url for example is http://localhost:2940/website/page.aspx?ID=1 when i change id to http://localhost:2940/website/page.aspx?ID=100000000000000000000000000000000000 i get error manege The conversion of the nvarchar value '20000000000000000000000000000000' overflowed an int column. i need if the ID dose not exist in database table , redirect the page to homepage thx all

              S Offline
              S Offline
              Shah Rizal
              wrote on last edited by
              #6

              Try this but the code is in vb,get the idea and convert to C#(if you use C#)

              Private Function CheckID(ByVal strID As String)
              Dim strSQL As String
              Dim conn As New OracleConnection
              Dim reader As System.Data.OracleClient.OracleDataReader

              strSQL = "Select ID From Where ID = '" & strID & "'"
              Dim cmd = New OracleCommand(strSQL , conn)
              reader = cmd.ExecuteReader()
              If reader.Read() Then
              If reader.HasRows Then
              Return True
              Else
              Return False
              End If
              Return ""
              End IF

              In your page load or load complete,call CheckID() and insert ID into it.

              Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

              If CheckID("") = True Then
              Response.Redirect("newpage.aspx")
              Else
              Response.Write("Error. There is no page ID in our database"
              End If

              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