Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual Studio C#webbrowser是否将url的一部分更改为int?_C# - Fatal编程技术网

Visual Studio C#webbrowser是否将url的一部分更改为int?

Visual Studio C#webbrowser是否将url的一部分更改为int?,c#,C#,所以我试图设置URL的一部分 例如: https://thisisawebsite.com/id=someid&some&more&stuff&that&has&to&be&here 如何从我的代码中将“someid”设置为int?这是可能的吗?或者最好的方法是什么 真的很抱歉犯了这么大的错误!我忘了加上我正在尝试使用Webbrowser.Navigate(url)。就这么简单: int someid = //Whatever y

所以我试图设置URL的一部分

例如:

https://thisisawebsite.com/id=someid&some&more&stuff&that&has&to&be&here
如何从我的代码中将
“someid”
设置为int?这是可能的吗?或者最好的方法是什么


真的很抱歉犯了这么大的错误!我忘了加上我正在尝试使用Webbrowser.Navigate(url)。

就这么简单:

int someid = //Whatever your int value is
String SUrl = "https://thisisawebsite.com/id=" + someid;

Server.Transfer(SUrl, true);

您正在寻找字符串连接的奇迹。您的代码在哪里!到目前为止你试过什么?如果选民能解释,那就太好了。因为这是我每天在项目中使用的工作代码,并且100%准确。不是我,但我猜它被否决了,因为您将字符串与+连接,而不是使用String.Format。想象一下,添加所有URL参数后,这段代码会变得多么丑陋。。。原来的问题只要求一个变量。虽然这是事实,但它仍然是一种糟糕的编码技术。既然你说你每天都在项目中使用这段代码,我强烈建议你重构它。
int id = 9999;
string uri = string.Format("https.//thisisawebsite.com/id={0}", id);