user822848
user822848

Reputation:

using Response.Write for redirecting to page

When I use code like Response.Write("REDIRECT=http://mydomain.com/Result.aspx") , The result page html is not getting displayed. Instead I am getting "Page Not Found" Error. Also in the url result page has text like " Result.aspx%3C!DOCTYPE%20html%20PUBLIC".

Please help me how can i redirect to result page properly.

Upvotes: 1

Views: 5144

Answers (3)

Metehan Teber
Metehan Teber

Reputation: 314

Response.Write("<script>window.location='http://mydomain.com/Result.aspx';</script>");

Upvotes: 0

RohitWagh
RohitWagh

Reputation: 2097

on the page where you are writing Response.Write , Remove the Following line from design file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

or similar line.

For ex: if Response.Write was on abc.aspx.cs then remove the above mentioned line from abc.aspx

Hope this helps. Worked for me.

OR else if the pages are only for response/request purpose then remove everything from page except

@page directive Everyting means everything between <html> and </html> and also DOCTYPE line

this might work..

Upvotes: 2

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

You have to use Response.Redirect

Response.Redirect("http://mydomain.com/Result.aspx");

Upvotes: 3

Related Questions