views:

58

answers:

2

I am writing a C#, say a, code to display some information from data base. and sending that information to an excel sheet. For excel sheet i have return the script in another page. If there is no record in the data source it should come back to the main page i.e. to page a. How can i handle this.

A: 
if (RecordCount == 0)
{
    Response.Redirect("a.aspx");
}
Martin
A: 

In case your admins are doing URL rewriting you may have to pay attention where to redirect. So you may have to do the Redirect(..) relative to your application URL. Here's a good post which gives some insight in how to do that.

Juri