HttpUtility is not a member function of web... error in URL encode / decode

What I am trying to get
I am trying to URL encode a string in my workflow.
What I did
I used this function: System.Web.HttpUtility.HtmlEncode(string)

What is the issue ?
I used this same function on my earlier project without any issue. But when I created a new workflow file ? Its showing issue… HttpUtility is not a member function of web. Below is the both project screenshot.

On one project this function work fine
image

And another project the same function show error.
image

Please help me to URL encode my string. Thanks

1 Like

Hello @Tech_Guru

I think you have to add this under imports…
Next to the arguments and the variables panels, you have another panel called “Imports”.

Can you get there and add a new import like
System.Web
System.Web.HttpUtility

This should work

1 Like

In imports tab… System.Web is available in both projects.
But System.Web.HttpUtility is not available in any project.
So I dont think this may be issue.

1 Like

@Tech_Guru

Please check below thread.

http://larakannan.blogspot.com/2010/06/httputility-is-not-member-of-web-in.html?m=1

1 Like

According to URL shared by you. I need to change the .NET framework version. But How to do this in uipath studio ? @lakshman

2 Likes

@Tech_Guru

I sent that link to check whether you are using same .NET Framework version or not.

Do one thing. Open both xaml files the one is working and other one not working with notepad application and compare all Assembly References used in that.

1 Like

Which .net version are you using?

@Lahiru.Fernando
I dont know which .net version it is… I am using UiPath 2019.11 Beta version

I Studio, you can see it if you go to Help tab.

Also, check what @lakshman mentioned and let us know…

1 Like

@lakshman @Lahiru.Fernando
Please download given below working & non working files.

working example.xaml (4.1 KB) Not working example.xaml (6.6 KB)

Also keep in mind. Both files are part of same project in same UiPath Studio Version. Also created on same day. Both are stored in same folder.

1 Like

@Tech_Guru

Ok. Will check and let you know.

@Lahiru.Fernando

Studio 2019.11.0-beta.2 - 11/18/2019
Community Edition

Microsoft Windows 10 Enterprise 64-bit
.NET Framework Version 4.7.2

@Tech_Guru

I opened both xaml files with notepad application and found visual Basics settings are different for both xaml files.

It’s for Not Working example.xaml file.

It’s for Working example.xaml file.

image

So I changed according to working file and issue got solved. Please find the attached workflow for your reference.

Not working example.xaml (6.6 KB)

2 Likes

Thanks dear @lakshman . I edited the file as you told. And its worked. Great.

But again I stuck in the issue. I was facking this issue on 2 workflow. On 1 workflow you resolved the issue. And in 2nd workflow ( attached below ) your method do not work. I found that the 2nd workflow is already have the same setting as told by you. So I cant edit anything.

Please look attached workflow file.

Not working example 2.xaml (4.3 KB)

1 Like

@Tech_Guru

May I know what error are you getting here ?

I am going out now and can’t check it now. Could you open both xaml files with notepad and compare it.

Dear @lakshman

Error is same as above. HttpUtility is not a member function of web.

I have compared and found that mva:VisualBasic.setting is the same as told by you. But then why this error comes. I don’t know.

@lakshman
Plz you look into this. You compare it. I found same.

1 Like

@Tech_Guru

Do one thing. Copy the same working xaml file into the project folder and rename the file. Then add other things in it.

@lakshman
Both files are bigger, Have almost more then 100-100 activites. In your case I have to build it again. have to set all properties again one by one. It will be not an ideal method.

I can not understand that one file support web.httputility function. and 2nd file in same project dont support. What may be the reason. Even VB version are same in both. All installed dependency are also the same.

Is there any function to URL encode the string instead of this.

@lakshman @Lahiru.Fernando