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 URL problem

Redirect URL problem

Scheduled Pinned Locked Moved ASP.NET
comsecurityhelptutorialquestion
4 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.
  • Z Offline
    Z Offline
    zeeShan anSari
    wrote on last edited by
    #1

    hi all , this my codebehind on login button click

    FormsAuthentication.Initialize(); FormsAuthenticationTicket ObjTicket = new FormsAuthenticationTicket(1, txtLoginId.Text, DateTime.Now, DateTime.Now.AddMinutes(60), false, txtLoginId.Text + "," + txtPassword.Text, FormsAuthentication.FormsCookiePath); string encTicket = FormsAuthentication.Encrypt(ObjTicket); string sLoginId = txtLoginId.Text; sLoginId = sLoginId.Replace(" ", ""); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)); Response.Redirect(FormsAuthentication.GetRedirectUrl(txtLoginId.Text, false)+"?id="+txtLoginId.Text);

    and this is web config code

    <authentication mode="Forms"> <forms defaultUrl="~/PresentationLayer/Forms/Main.aspx" loginUrl="~/Default.aspx" > </forms> </authentication>

    above code well working on local host .......but on live host "~/" append with url for example i want www.abc.com/abc/PresentationLayer/Forms/Main.aspx but i get www.abc.com/abc/~/PresentationLayer/Forms/Main.aspx can anybody tell me that where is problem

    A E 2 Replies Last reply
    0
    • Z zeeShan anSari

      hi all , this my codebehind on login button click

      FormsAuthentication.Initialize(); FormsAuthenticationTicket ObjTicket = new FormsAuthenticationTicket(1, txtLoginId.Text, DateTime.Now, DateTime.Now.AddMinutes(60), false, txtLoginId.Text + "," + txtPassword.Text, FormsAuthentication.FormsCookiePath); string encTicket = FormsAuthentication.Encrypt(ObjTicket); string sLoginId = txtLoginId.Text; sLoginId = sLoginId.Replace(" ", ""); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)); Response.Redirect(FormsAuthentication.GetRedirectUrl(txtLoginId.Text, false)+"?id="+txtLoginId.Text);

      and this is web config code

      <authentication mode="Forms"> <forms defaultUrl="~/PresentationLayer/Forms/Main.aspx" loginUrl="~/Default.aspx" > </forms> </authentication>

      above code well working on local host .......but on live host "~/" append with url for example i want www.abc.com/abc/PresentationLayer/Forms/Main.aspx but i get www.abc.com/abc/~/PresentationLayer/Forms/Main.aspx can anybody tell me that where is problem

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

      zeeShan anSari wrote:

      forms defaultUrl="~/PresentationLayer/Forms/Main.aspx"

      Check whether replacing ~/PresentationLayer/forms with PresetationLayer/forms does cure ....:rose:

      Abhishek Sur


      My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

      **Don't forget to click "Good Answer" if you like to.

      Z 1 Reply Last reply
      0
      • A Abhishek Sur

        zeeShan anSari wrote:

        forms defaultUrl="~/PresentationLayer/Forms/Main.aspx"

        Check whether replacing ~/PresentationLayer/forms with PresetationLayer/forms does cure ....:rose:

        Abhishek Sur


        My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

        **Don't forget to click "Good Answer" if you like to.

        Z Offline
        Z Offline
        zeeShan anSari
        wrote on last edited by
        #3

        it does not working. and bellow message show on page Server Error in '/exxnew' Application. -------------------------------------------------------------------------------- The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /exxnew/~/PresentationLayer/Forms/Main.aspx now i use

        Response.Redirect("/PresentationLayer/Forms/Main.aspx",false);

        it's work well on local host but on live host its append /~

        1 Reply Last reply
        0
        • Z zeeShan anSari

          hi all , this my codebehind on login button click

          FormsAuthentication.Initialize(); FormsAuthenticationTicket ObjTicket = new FormsAuthenticationTicket(1, txtLoginId.Text, DateTime.Now, DateTime.Now.AddMinutes(60), false, txtLoginId.Text + "," + txtPassword.Text, FormsAuthentication.FormsCookiePath); string encTicket = FormsAuthentication.Encrypt(ObjTicket); string sLoginId = txtLoginId.Text; sLoginId = sLoginId.Replace(" ", ""); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)); Response.Redirect(FormsAuthentication.GetRedirectUrl(txtLoginId.Text, false)+"?id="+txtLoginId.Text);

          and this is web config code

          <authentication mode="Forms"> <forms defaultUrl="~/PresentationLayer/Forms/Main.aspx" loginUrl="~/Default.aspx" > </forms> </authentication>

          above code well working on local host .......but on live host "~/" append with url for example i want www.abc.com/abc/PresentationLayer/Forms/Main.aspx but i get www.abc.com/abc/~/PresentationLayer/Forms/Main.aspx can anybody tell me that where is problem

          E Offline
          E Offline
          Edbert P
          wrote on last edited by
          #4

          AFAIK ASP.NET does not translate ~ into your root web application path when used within the defaultUrl attribute. You can most likely be able to replace it with /exxnew/PresentationLayer/Forms/Main.aspx (where /exxnew denotes your prod website's virtual root path)

          "A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin Edbert Sydney, Australia

          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