In the development project process, because to integrate Cognos report through the URL, but the Cognos report itself URL length process, then need to develop a jump page, below we use VS2010 to develop a jump page default.aspx
1: Open VS2010 new Web site
2: Select C # language, ASP. NET Empty Web site
3: Project Jumppage has been created, there is a Web. config profile by default
4: In this example, the Web. config content is, add the appsettings node, for the following operations to use
<?xml version="1.0"?><!--For more information about how to configure an ASP. NET application, go to http://go.microsoft.com/fwlink/?linkid=169433--><configuration> <system.web> <compilation debug="true"targetframework="4.0"/> </system.web> <appSettings> <add key="1"Value="http://www.baidu.com/"/> <add key="2"Value="http://www.cnblogs.com/"/> </appSettings></configuration>
4: Create a new file, select Web Form, the system is named Default.aspx by default
5: As shown, each ASPX page corresponds to a aspx.cs page, the former is a display, the latter is a design event and code
6: An Page_Load method is automatically generated in the aspx.cs of ASPX corresponding to this example Default.aspx.cs encoded as follows
protected voidPage_Load (Objectsender, EventArgs e) { //get a pass-through Reportkey, if the user is prompted to select a report if(request.querystring["Reportkey"] ==NULL) {Clientscript.registerstartupscript ( This. GetType (),"message","<script language= ' javascript ' >alert (' Please select a report! ');</script>"); return; } //if not empty, use response to redirect to report URL Else { stringReportkey = request.querystring["Reportkey"]; stringReportpath =System.configuration.configurationmanager.appsettings[reportkey]. ToString (); Response.Redirect (Reportpath); } }
Code parsing: System.configuration.configurationmanager.appsettings[reportkey]. ToString (); The function is to take out the value of key reportkey in the <appSettings> node in the Web. config configuration file
7: Publish Web site in Browser view effect
Access Web site without parameters
Access Web site with parameter key
Effect, successfully jump to Key=1 specified address <add key= "1" value= "http://www.baidu.com/"/>
8: Logical Interpretation
Access the ASPX page to specify the path of the jump to the parameter, the path of the jump in the Web. config configuration
Using VS2010 to develop a jump page aspx