简体   繁体   中英

To what namespace does Response.Redirect belong to?

When i write this in a static class i get red line bellow Response:

  Response.Redirect("ErrorPage.aspx.aspx?Error=" + READERROR);

It asks me whether i have got a missing assembly. How do i fix this?

Namespace: System.Web

Assembly: System.Web (in System.Web.dll)

But if you are defining in Static class, then I think it should be...

HttpContext.Current.Response.Redirect(....);

Use this except of Response.Redirect("SomePage.aspx");

System.Web.HttpContext.Current.Response.Redirect("SomePage.aspx");

because Response (it is object and class is HttpWebResponse ) is the member of Page class.

In namespace are definted types (classes, strucutres, interfaces, ...) and the methods are in in types (not in delegates and enums).

The "Response" is not the class (however HttpWebResponse is). The line Response.Redirect("ErrorPage.aspx.aspx?Error=" + READERROR); looks like from code in class derived from System.Web.UI.Page . In this class is property named Response and for using this property you will need no using.

However the HttpWebResponse is in:

Namespace: System.Net

Assembly: System (in System.dll)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM