Asked by:
Error when trying to save XML file.

Question
-
User944339287 posted
Hi guys.
My site will go to
http://www.mydomain.com/login.aspx?ReturnUrl=%2fuser-portal%2femail.html
when i trying to save XML file at
http://www.mydomain.com/user-portal/email.html
Any idea? It only happened when I upload to my web server. Working properly when i test in localhost.
Below is my code to save xml file.
Dim xmldoc As New XmlDocument() xmldoc.Load(Server.MapPath("~/App_Data/Email.xml")) Dim xmlnode As XmlNode = xmldoc.DocumentElement.ChildNodes.Item(0) xmlnode("hostname").InnerText = Me.txt_hostname.Text xmlnode("port-number").InnerText = Me.txt_portnumber.Text xmlnode("ssl").InnerText = Me.ddl_ssl.SelectedValue xmlnode("username").InnerText = Me.txt_username.Text xmlnode("password").InnerText = Me.txt_password.Text xmlnode("from").InnerText = Me.txt_username.Text xmlnode("reply-to").InnerText = Me.txt_username.Text xmlnode("fromName").InnerText = Me.txt_from_name.Text xmlnode("recipient").InnerText = Me.txt_recipient.Text xmldoc.Save(Server.MapPath("~/App_Data/Email.xml")) 'show result Response.Write("<script language='javascript'>window.alert('Saved Successfully.');window.location='/web-portal/email.html';</script>")
Wednesday, September 18, 2019 4:18 PM
All replies
-
User665608656 posted
Hi kengkit,
After testing your code, it ran successfully in localhost and my web server.
Could you provide us with detailed error information,which will help us solve your issue more easily.
Best Regards,
YongQing.
Thursday, September 19, 2019 5:33 AM -
User944339287 posted
Hi Yong Qing,
This is the returned error message after i tried to save the XML file. It's working fine in localhost but only happened when I upload to the web server.
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /login.aspx
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3429.0
Friday, October 4, 2019 2:59 AM -
User753101303 posted
This is what happens if you try to use http://www.mydomain.com/user-portal/email.html directly in the address bar of your browser ? Or is this really on /login.aspx
F12 Network could also perhaps help to figure the exact address. In short it means the browser tries to load something from your web site, but the server side doesn't find anything that could be sent back at this location.
A common cause is having a site..com/page.html in development but a site.com/app/page.html in production (and trying mistakenly to still fetch site.com/page.html)
Not sure how your XML and html page are related by you can't get anything stored in App_Data. If not ASPX page is working it could be the site is not even configured to handle ASP.NET.Edit: try perhaps
window.location.href='/web-portal/email.html';
Friday, October 4, 2019 11:52 AM