Click here to Skip to main content
15,917,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,

I am using VS 2005.My requirement is web page populating data from an xml file and if this xml file doesnot find/exist then it should redirect to another webpage ErrorPage.aspx.

Kindly help me out where I am going wrong.

Thanks

Manushi
Posted
Updated 1-Feb-11 0:19am
v4
Comments
Prerak Patel 1-Feb-11 6:05am    
Check the updated answer. ScriptManager.RegisterStartupScript

How To Open a Web Page In a New Browser ASP.NET?[^]

[EDIT]According to your changed requirement

Just check
try
{
if (File.Exists(filePath))
            {
                FileStream sr = new FileStream(filePath, System.IO.FileMode.Open);
                XmlTextReader xtr = new XmlTextReader(sr);
                 ds.ReadXml(xtr);
            }
            else
            {
                Response.Redirect("errorpage.aspx");
            }
}

[/EDIT]
 
Share this answer
 
v2
Shouldn't it be

Response.Redirect("Error.aspx");
 
Share this answer
 
manushi88 wrote:
1) on a button click, new web page(New.aspx) should open, leaving the previous one opened.


target ='_blank' to your button.


manushi88 wrote:
if this xml file doesnot find/exist then it should redirect to another webpage ErrorPage.aspx.


C#
ScriptManager.RegisterStartupScript(page,
                typeof(Page),
                "Redirect",
                "window.open('./error.aspx');",
                true);
 
Share this answer
 
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900