Locating Your Current Context In SharePoint

To get your current location in SharePoint use:

SPControl.GetContextWeb(Context)

If you need to find the subweb, there is a web property in the SPWeb object you retrieved in the above code:

SPWeb currentWeb = Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(Context)