Luis
Luis

Reputation: 31

C# Code URl Issues

Hello guys i am working on a Database an i am getting stuck i have a code to go to a site, log me in , and then open a new tab that would open a transaction page but the link i have has a space and when chrome gets it it searches only the first part.

Here is the code. System.Diagnostics.Process.Start("chrome.exe", " http://database.spincap.com/transaction/search/#entity/SCAP-3 LLC/review_capital/1323");

That is the one i am testing and when i reun that i get the following results

enter image description here

Can someone help me please

after that i am turning the code into

        // System.Diagnostics.Process.Start("chrome.exe", " http://database.spincap.com/transaction/search/#entity/" + PendingTran_Entityname + "/review_capital/" + PendingTran_ID+"");

Upvotes: 1

Views: 50

Answers (2)

minXak
minXak

Reputation: 11

There are different approaches to encode URL

For example:

HttpUtility.UrlEncode("YourUrlGoesHere")

See more informatoin on this topic and use method that suits you the most: How do you UrlEncode without using System.Web?

Upvotes: 0

Gabor
Gabor

Reputation: 3256

You have to put the parameter between double quotation marks:

Process.Start("chrome.exe", "\"http://database.spincap.com/transaction/search/#entity/SCAP-3 LLC/review_capital/1323\"");

Without the double quotation marks the space character is a delimiter for command line arguments.

Upvotes: 1

Related Questions