• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

179
Views
How to add URL as a parameter in Asp.net

I am in a situation where I need to pass URL as a parameter from javascript to Controller. But when I pass URL as a parameter I get error

async sendSmsNotification() {
var url = new URL(`https://chats.landbot.io`);
var PlanId = "123";
await NotificationService.sendNotification(PlanId, url);
}

export async function sendNotification(PlanId: string, url: string) {
    let url = HttpClient.buildUrl(`api/sendNotification/${PlanId}/${url}`);
    return await HttpClient.get(url);
}

Below is the actionmethod where I am expecting url link

        [HttpGet("Notification/{PlanId}/{url}")]
        [ValidateModelState]
        public async Task<IActionResult> SendNotification(Guid PlanId, string url)
        {
            var Plan = await _PlanRepository.GetPlan(PlanId, SecurityToken);

            try
            {
                return NoContent();
            }
            catch (ArgumentException ex)
            {
                return BadRequest(ex.Message);
            }
        }

I am getting this error

httpClient.ts:98 GET https://localhost:44386/api/Notification/c2776efe-49aa-46ff-a7f8 404

almost 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error