Click here to Skip to main content
16,023,047 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am fetching a url from my database.And I have to pass this url to response.redirect("string");

but when i pass my string it does not go to next page instead it just show my string name in the url bar of the browser.

here is my code:

C#
SqlDataAdapter da = new SqlDataAdapter(Qstr_pane2, Connection);
DataSet ds = new DataSet();
da.Fill(ds,"Table" );

string URL = ds.Tables[0].Rows[0][2].ToString();
/*here i have to convert URL string  to actual link where is have to redirect the page */
Response.Redirect("URL");
Connection.Close()


please help

Regards,
Amol
Posted
Updated 6-May-10 19:44pm
v3

MIDL
string url = "http://google.com";
        Response.Redirect(url);

This will work. use URL without quests i.e Response.Redirect(URL);
 
Share this answer
 
AmolNagrkar wrote:
Response.Redirect("URL");

You have used 'URL' as a string here instead of a variable!

Try:
C#
Response.Redirect(URL);
 
Share this answer
 
AmolNagrkar wrote:
Response.Redirect("URL");


Remove the double quotes. So it will be like,
C#
Response.Redirect(URL);


AmolNagrkar wrote:
Connection.Close()

It's a disconnected architecture and you don't need that. Even if you have established a connection for some other purpose (code not shown), move this line before Response.Redirect();
 
Share this answer
 
Comments
AmolNagarkar 7-May-10 5:35am    
thanks for that extra input of response.redirect code.It was by mistake.

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