Adding new website url validation rules using URI properties in .net
₹750-1250 INR / hour
Closed
Posted 9 months ago
₹750-1250 INR / hour
Need to add few rules to the exsiting code.
public void Define()
{
Flight flight = default;
Provider sourceRecord = default;
Provider resultRecord = default;
When()
.Match(() => flight)
.Match(() => sourceRecord, i => [login to view URL] == [login to view URL] && [login to view URL]() == "source" && ![login to view URL]([login to view URL]))
.Match(() => resultRecord, i => [login to view URL] == [login to view URL] && [login to view URL]() == "result" && ![login to view URL]([login to view URL]))
.Having(() => CheckUrlMatches([login to view URL], [login to view URL]));
Then()
.Do(ctx => [login to view URL](flight));
}
public bool CheckUrlMatches(string sourceUrl, string resultUrl)
{
if (!IsValidWebsite(sourceUrl) || !IsValidWebsite(resultUrl))
{
return false;
}
[login to view URL](sourceUrl, [login to view URL], out Uri sourceUri);
[login to view URL](resultUrl, [login to view URL], out Uri resultUri);
if (sourceUri == null || resultUri == null)
{
return false;
}
// Check if source and result domains match
if (![login to view URL]([login to view URL], [login to view URL], [login to view URL]))
{
// Check if source is blank and result is a valid URL
if ([login to view URL](sourceUrl) && IsValidWebsite(resultUrl))
{
return true; // Updates in quest
}
return false; // Go to polaris
}
// Check if source and result URLs match except for scheme, host, and query
if ([login to view URL] != [login to view URL] || [login to view URL] != [login to view URL])
{
return false;
}
// Check if source and result URLs match except for scheme, host, and extension
string sourceAdjustedValue = AdjustedUrlValue(sourceUrl);
string resultAdjustedValue = AdjustedUrlValue(resultUrl);
if (![login to view URL](sourceAdjustedValue, resultAdjustedValue, [login to view URL]))
{
return false;
}
return true;
}
public string AdjustedUrlValue(string url)
{
string adjustedValue = [login to view URL]().Replace("https://", "").Replace("http://", "").Replace("www.", "");
int indexOfLastPeriod = [login to view URL](".");
if (indexOfLastPeriod < 3 || [login to view URL](indexOfLastPeriod).Length < 2)
{
return adjustedValue;
}
return [login to view URL](0, indexOfLastPeriod);
}
public bool IsValidWebsite(string url)
{
Uri uri;
return [login to view URL](url, [login to view URL], out uri) &&
([login to view URL] == [login to view URL] || [login to view URL] == [login to view URL]);
}
```
Need to verify above code works for all the below scenario
Whether this code checks below scenario Whether the source or result matches
whether the source or result value matches except beginning of the website such as (htpps://,http:// ,www.)
Whether the source or result value matches except domain extension like (.com,.org,.edu)
Usecase
Source Result ExceptedREsult
https//[login to view URL] [login to view URL]
[login to view URL] [login to view URL]
htps:/[login to view URL] [login to view URL]
[login to view URL] [login to view URL]
[login to view URL] N/A
None
[login to view URL] N/A
[login to view URL] [login to view URL] source and result domain doesn’t match go to polaris
[login to view URL] Need to update in quest only when source is blanck and result is valid url
Top 1% in Freelancer.com
Hi, Greetings!
✅checked your project details:
✅Completed Time: In project deadline
We have worked on 900 + Projects. I have 6 + years of the experience in same kind of projects. If you are looking for a true Freelancer, I am the Right person for you. I am available almost 24-7 and am very responsive. I feel proud that I am a trusted Freelancer who pleases almost every single client. You can rest assure, your work will be delivered well in advance of others, with passion and accuracy. I guarantee you instant communication & responses when you need me. Why choose me? I think every client is the reason for my success. I only take projects which I am sure I can do quickly.
My Portfolio Items: https://www.freelancer.com/u/schoudhary1553
I would really like to work with you on this project. If interested, Kindly contact me via chat for further details and discussion.
Thank you
Sandeep
Hello, my name is Dimpal and I am part of the team at Balkrushna Technologies. We specialize in .NET, C# programming, PHP and other related technologies. We understand that you need to add new website url validation rules using URI properties in .NET and we would be delighted to help!
We have experience in PHP, ReactJS, NodeJS and Blockchain technologies which will be useful for this project. Additionally, we provide dedicated developers for long-term projects so you can rest assured that your work will be completed on schedule. We also guarantee performance evaluation so you can feel confident about our reliability as well as pleasant experience during the process.
If you have any concerns or would like more information about our services please don't hesitate to reach out to us directly. We look forward to hearing from you soon!
Best regards,
Dimpal