开发者

$_GET in ASP and choose file

I'm trying to write ASP for the first time, I've only been using PHP for some years and never really got in to ASP. What I want to do is to get a value from the URLs get. For instance the url is like: page.asp?id=1

Then I wa开发者_如何转开发nt this value to be in an include like:

<!--#include file="somepage_$_GET[id].html"-->

How can this be achieved through ASP?

Peace


Use Request.QueryString["id"]

protected void Page_Load(object sender, EventArgs e)
{
    int id;
    bool res = int.TryParse(Request.QueryString["id"], out id);
    if (res)
    {
        // id is present
    }
    else
    {
        // id is absent
    }

    ....


The equialent term for $_GET['id'] in PHP is in ASP Request.QueryString("id") if you per say are using id as your term.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜