Pregunta

I need to run an ASP.NET page with some parameter.

For example :

When I run the project Default.aspx opens in the browser.
I want to open Default.aspx?CONFERENCEID=3

Is this possible?

¿Fue útil?

Solución 2

Right click on the website project..Select Property pages..select Startup options.. Set specific page property as

Default.aspx?CONFERENCEID=3

Otros consejos

You can do it man

Add this code in your default screen pageload event

Page-load()//Point 1
{
 if(string.IsNullorEmpty(Request.QueryString("CONFERENCEID").Tostring()))// Point 3
 {
    Response.Redirect("Default.aspx?CONFERENCEID="+ 3);
 }
   string value=Request.QueryString("CONFERENCEID").Tostring()//Point 2
}

Where,

When you run your application

  1. The default screen pageload function will load

  2. if the url have any (CONFERENCEID) query string then store the query string values into a variable

  3. otherwise it's redirect to same page( like reload) with a query string.

    • This is a simple logic. But other members will give another idea's.

You can set the startup page in the project properties: enter image description here
Set it to Specific page or Start URL.

This is how you do it in VS2015:

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top