Need a ASP script to produce a SSI - when the URL matches a condition

Discussion in 'C#' started by The_Hatta, Mar 31, 2011.

  1. #1
    Hello DP members

    I need some help with a SSI ( Server side Include)

    when the URL matches on a dynamic page - i need it to produce the SSI to the browser to link to a .inc file to dynamically change the title

    it needs to work off a /images.aspx?id=1

    so image 1 would include it but 2 would not

    i have the later working - i just need the asp script to produce the SSI code ,

    HELP please :D
     
    The_Hatta, Mar 31, 2011 IP
  2. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #2
    SSI's are fairly crude technologies to be using for .Net.

    What is the include?

    If you want to simply show a Div or not depending on if it is ID=1 or ID=2 then make the div an <asp: panel /> and use the load event to effect its Visibility property.

    protected void Page_Load(object sender, EventArgs e)
    {
    	if (!IsPostBack) {
    		if (request.querystring("ID") == 1) {
    			DisplayPanel.Visible = true;
    		} else {
    			DisplayPanel.Visible = false;
    		}
    	}
    
    }
    Code (markup):
     
    AstarothSolutions, Apr 2, 2011 IP
  3. The_Hatta

    The_Hatta Greenhorn

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    The ssi is - Meta data pertaining to the content of the page - the site wasn't designed for SEO and now i have to make it, i figured SSI is the best for the way we need to edit it,
     
    The_Hatta, Apr 2, 2011 IP
  4. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If it is meta data for all pages then use a MasterPage instead containing it and do the Load sub against the masterpage rather than its child. As its in the header just put in an <asp:Literal /> and set its Text attribute after testing the querystring
     
    AstarothSolutions, Apr 4, 2011 IP
  5. The_Hatta

    The_Hatta Greenhorn

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    it's spefic only to that page, after a query to the database, and yes i could include it into the header, but i don;t have the original files, so i'm kinda flying blind here,
     
    The_Hatta, Apr 4, 2011 IP
  6. unknownpray

    unknownpray Active Member

    Messages:
    3,831
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    70
    #6
    simply follow the code:
    de:

    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack) {
    if (request.querystring("ID") == 1) {
    DisplayPanel.Visible = true;
    } else {
    DisplayPanel.Visible = false;
    }
    }

    }
     
    unknownpray, Jun 25, 2011 IP