I'm learning SharePoint 2010 and facing a strange problem :
I implement a custom action to add a ribbon button under Documents tab, this button has a command to open a modal dialog in my site which is being located at http://sharepointserver/dev/
.
The Url parameter of showModalDialog function is pointed to my application page : test.aspx. The code of test.aspx.cs as below:
......................
protected void Page_Load(object sender, EventArgs e)
{
SPWeb web = this.Web;
try
{
SPList list = web.Lists[this.TargetListId];
SPListItem item = list.GetItemById(this.TargetItemId);
}
}
My problem here is this.Web always points to http://sharepointserver
, not my current site
http://sharepointserver/dev/
. This results in list #notfound when I execute SPList list = web.Lists[this.TargetListId]
My Sharepoint project Site URL is http://sharepointserver/dev/
and Feature Scope is being set to Web so I don't know why this.Web doesn't want to give me the current site address. (SPContext.Current.Web also has a same problem)
Any help will be appreciated.