Replying with a html page in HTTP Web Server using esp01 and ArduinoIDE Now there are many ways to reply with a webpage content to a user who is accessing the web server,
But Keeping in mind to use as less space as possible,
I was trying something new, Since i didnt got compilation error, I am a little confused as to what might be the error,

in void data() I am storing the html page and saving it in ROM,

void data()
{
  if(SPIFFS.exists("/login.html"))
  {
    Serial.println();
  }
  else{
    SPIFFS.begin();
    File f=SPIFFS.open("/login.html","w");
    String s="&lt;html&gt;&lt;head&gt;&lt;title&gt;AP&lt;/title&gt;&lt;h1&gt;Welcome to AP page&lt;/h1&gt;\n";
    s+="&lt;/head&gt;&lt;body&gt;&lt;form name=\"/myform\" action=\"/login\" method=\"POST\"&gt;\n";
    s+="&lt;input type=\"text\" name=\"username\" placeholder=\"username\"&gt;&lt;br/&gt;\n";
    s+="&lt;input type=\"password\" name=\"password\" placeholder=\"password\"&gt;&lt;br/&gt;\n";
    s+="&lt;input type=\"submit\" value=\"login\"&gt;&lt;/form&gt;&lt;/body&gt;&lt;/html&gt;";
    f.println(s);
    f.close();
  }

}


Please correct the above lines if I wrote it wrong,
After that, 
I wrote some lines in void setup()

WiFi.mode(WIFI_AP_STA);//Only Access point
  WiFi.softAP(ssid, password);  //Start HOTspot removing password will disable security

  IPAddress myIP = WiFi.softAPIP(); //Get IP address
  Serial.print("HotSpt IP:");
  Serial.println(myIP);

  server.on("/", HTTP_GET, handleRoot);      //Which routine to handle at root location
  server.on("/",HTTP_POST,handlelogin);
  server.onNotFound(handleerror);

  server.begin();   


Now  I am calling void handleRoot() 
I want to send the page that I wrote and saved in the /login.html file.

so for that,

void handleRoot()
  {
    SPIFFS.begin();
    File f=SPIFFS.open("/login.html","r");
    server.send(200, "text/html",f.readStringUntil('EOF'));
  }


Now once I do this and execute and load the program in ESP01, it shows me nothing,
I have also tried sending (String)f, anything else I write is giving me an error,
This is compiling fine, but when I connect to the AP and open 192.168.4.1 in the browser i am not seeing anything, 
But when I wrote server.send(200,"text/html",(String)f)
I was getting 0, Any idea on what mistake I am making.
Small update, I used the same code for ESP8266 NodeMCU.

Sorry If I am posting this with wrong device number. But I tried that same code and uploaded it to ESP8266, it worked, and I am getting the AP webpage, that I am storing and sending the file. I will post it as an answer as I need to post an image.

The is the page that I get when using the HTML that I wrote:


  


So, this happened. I am confused as to why it didn't work with ESP01, plus I have to load the code every time I plug in the ESP01.