A method of connecting an image forming apparatus to an infrastructure network, the method comprising: executing a Wi-Fi Direct wireless communication function of the image forming apparatus configuring the image forming apparatus to operate as a software access point, soft AP; displaying, when the image forming apparatus is connected to an external wireless device via the Wi-Fi Direct wireless communication function, an embedded web page provided by the image forming apparatus on the connected wireless device; receiving access information of the infrastructure network, to which the image forming apparatus is to be wirelessly connected, from the wireless device, wherein the access information is input via the displayed embedded web page; attempting connection to the infrastructure network by using the access information received from the wireless device, wherein the attempting is performed by the image forming apparatus; ending the connection between the image forming apparatus and the wireless device via the Wi-Fi Direct wireless communication function, if connection to the infrastructure network is possible as a result of the connection attempt, and establishing a wireless network connection between the image forming apparatus and the infrastructure network based on the access information received from the wireless device when the connection between the image forming apparatus and the wireless device is ended, wherein the displayed embedded web page is a web page that provides a user interface screen for setting a wireless network connection between the infrastructure network, which is one of a plurality of infrastructure networks that can be wirelessly connected to the image forming apparatus and the image forming apparatus. executing a Wi-Fi Direct wireless communication function of the image forming apparatus configuring the image forming apparatus to operate as a software access point, soft AP; displaying, when the image forming apparatus is connected to an external wireless device via the Wi-Fi Direct wireless communication function, an embedded web page provided by the image forming apparatus on the connected wireless device; receiving access information of the infrastructure network, to which the image forming apparatus is to be wirelessly connected, from the wireless device, wherein the access information is input via the displayed embedded web page; attempting connection to the infrastructure network by using the access information received from the wireless device, wherein the attempting is performed by the image forming apparatus; ending the connection between the image forming apparatus and the wireless device via the Wi-Fi Direct wireless communication function, if connection to the infrastructure network is possible as a result of the connection attempt, and establishing a wireless network connection between the image forming apparatus and the infrastructure network based on the access information received from the wireless device when the connection between the image forming apparatus and the wireless device is ended, wherein the displayed embedded web page is a web page that provides a user interface screen for setting a wireless network connection between the infrastructure network, which is one of a plurality of infrastructure networks that can be wirelessly connected to the image forming apparatus and the image forming apparatus.