c# - How do I properly declare namespaces in my aspx page? -


i cannot seem add namespaces .aspx page without getting "a namespace cannot directly contain members such fields or methods". header of aspx project set so:

<%@ page language="c#" %> <%@ import namespace="system.data.sqlclient;"%> <%@ import namespace="system.io;"%> <%@ import namespace="system.net.mail;"%> <%@ import namespace="system.text;"%> <%@ import namespace="system.web;"%> <%@ import namespace="system.linq;"%> <%@ import namespace="system.web.security;"%> <%@ import namespace="system.web.ui;"%> <%@ import namespace="system.web.ui.webcontrols;"%> <%@ import namespace="system.web.ui.webcontrols.webparts;"%> <%@ import namespace="system.web.ui.htmlcontrols;"%> <!doctype html>  <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title>  </head> <body> <script runat="server"> protected void page_load(object sender, eventargs e)     {         lbldate.text = datetime.now.tostring();     } //more functions 

i did google search lead me here. talks finding app.config file. well, project has no app.config, when try add 1 in vs2012 not listed option.

don't know why asp.net compiler gives particular error, semi-colons what's causing issue. need remove them.

<%@ import namespace="system.data.sqlclient" %> 

Comments