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. General Programming
  3. C#
  4. Redirect URL problem

Redirect URL problem

Scheduled Pinned Locked Moved C#
comsecurityhelptutorialquestion
2 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.
  • 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

    L 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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      try the Asp.NET forum.

      Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]

      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