ADMQ4
ADMQ4
Grade 12 - ONION
1. Access to Data: Developers add Web APIs to applications to get data from other
sources easily. For example, if an app needs weather information, it can use a
weather API to fetch the latest updates without having to create its own weather
system. This saves time and effort, allowing developers to use reliable data from
experts.
2. Improved Features: Web APIs help developers add new features to their
applications without building everything from scratch. For instance, if an app wants to
accept payments, it can use a payment API like PayPal. This way, the app can offer
secure payment options quickly and focus on other important parts of the application.
Grade 12 - ONION
Introduction
ASP.NET provides HTTP Modules and HTTP Handlers to process requests at different
stages of the request-response pipeline. They help in modifying request or response data,
implementing custom authentication, logging, or handling specific requests.
HTTP Modules
HTTP Handlers
<configuration>
<system.webServer>
<modules>
<add name="CustomHttpModule" type="CustomHttpModule"/>
</modules>
</system.webServer>
</configuration>
<handlers>
<add name="CustomHttpHandler" path="customhandler" verb="*"
type="CustomHttpHandler" resourceType="Unspecified"/> </handlers>
Conclusion
Now you have a working HTTP Module and HTTP Handler in your ASP.NET MVC
application! Use modules for global processing and handlers for request-specific logic.
Name: ELJAY XYR T. CONDE Q4 Week 1 - Task 5
Grade 12 – ONION
/**
* Explanation:
* WebSockets establish a persistent, bi-directional connection between client and server,
* allowing real-time data exchange without the overhead of repeatedly making HTTP requests.
* This reduces latency and improves efficiency for applications requiring instant updates, such
as chat apps and live notifications.
*/
Name: ELJAY XYR T. CONDE Q4 Week 1 - Task 6
Grade 12 – ONION
using System.Net;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;
return httpResponse;
}
}
2. Deploy Code:
1. Use Zip Push Deployment ([Search Result 7]):
bash
az functionapp deployment source config-zip -g WeatherRG -n
WeatherForecastAPI --src ./publish.zip
2. Alternatively, deploy directly from Visual Studio using Azure Functions
Tools ([Search Result 10]).
To deploy the Azure Function for the weather forecast service to Azure, I
followed these steps:
1. Development Environment Setup: I developed the Azure Function using
Visual Studio, creating a C# class library project for Azure Functions. This
involved setting up the necessary NuGet packages and writing the function
code.
2. Publishing to Azure:
I right-clicked the project in Visual Studio and selected Publish.
In the Target section, I chose Azure and then Azure Function App
(Windows).
I created a new function app by specifying a globally unique name,
selecting my Azure subscription, choosing a resource group, and
setting the plan type to Consumption.
I enabled Run from package file to use zip deployment for better
performance.
3. Deployment:
Visual Studio automatically created a zip package of my project files
and deployed it to Azure using zip deployment.
The deployment process included setting up necessary Azure
resources like a storage account and Application Insights for
monitoring.
4. Configuration:
After deployment, I managed application settings through the Azure
portal or Visual Studio to ensure that sensitive keys like the Azure
Maps API key were securely stored and accessible to the function.
This process allowed me to quickly deploy and test my Azure Function in a
serverless environment, leveraging Azure's scalability and cost-effectiveness.
Name: ELJAY XYR T. CONDE Q4 Week 1 -
Task 7
Grade 12 – ONION
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;