HTTP REFER logic making it global?

Last post 10-16-2008 2:47 PM by chuck.catron. 1 replies.

Sort Posts:

  • HTTP REFER logic making it global?

    10-16-2008, 11:25 AM
    • Member
      202 point Member
    • paladinckm
    • Member since 05-12-2008, 7:20 PM
    • Posts 210

     I am using the HTTP Refer logic for redirecting my last (summary) page to the respective pages and then again back to summary page ,( after the user has made any changes).Now the problem I have with this logic is everytime the localhost no: changes ( when i run the project in my machine) I have change the no: in the code of al lthe 7 pages, (below is the code for more understanding) , Is there any way where I can have this done globally rather than hardcoding it everytime. Any help is appreciated.

     

    str = HttpContext.Current.Request.ServerVariables("HTTP_REFERER")
                    Session("str") = str
    If str1 = "http://localhost:1654/Project1/Summarypage.aspx" Then
                        Response.Redirect("Summarypage.aspx")
    Else
    Response.Redirect("Homepage.aspx")
    End if 
      
    Cheers
    Paladinckm
    One Who distributes his knowledge is Scholar
  • Re: HTTP REFER logic making it global?

    10-16-2008, 2:47 PM
    Answer
    • Member
      465 point Member
    • chuck.catron
    • Member since 09-18-2008, 12:12 PM
    • Dayton, Ohio
    • Posts 94

    You can just add a setting to web.config

     

    <appSettings>

       <add key="baseUrl" value=http://server.com />

     </appSettings>

     

    Then in your code string url = ConfigurationManager.AppSettings["baseUrl"].ToString();

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Chuck Catron
Page 1 of 1 (2 items)