Posted: 03-05-2010 | Author: flexicoder | Category: ASP.Net | No comments
If you need to force the user to a particular page, regardless of what the ReturnURL is stating, then use the following code in your Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack && !string.IsNullOrEmpty(Request.QueryString["ReturnURL"]))
{
//Do this to remove any URL info the user may be trying to get to
Response.Redirect(@"default.aspx");
}
}
If you have IE 8 installed and your ASP.Net project won’t stop on the breakpoints you’ve set they you probably need to read this article
You basically need to add an entry to your registry to stop process growth for tabs.
I’ve copied the steps required below
1) Open RegEdit
2) Browse to HKEY_LOCALMACHINE -> SOFTWARE -> Microsoft -> Internet Explorer -> Main
3) Add a dword under this key called TabProcGrowth
4) Set TabProcGrowth to 0
Posted: 08-07-2009 | Author: flexicoder | Category: ASP.Net | No comments
If you’ve locked down access to your website but what your login page to pick up a stylesheet from a sub folder then you need to a add a location tag to your web.config to grant access
In Visual Studio 2008 you’ve lost the abillity to click on the drop down in the code behind and see all the event signatures that are available but haven’t handled yet. To get the signature you are after without using the properites in the desinger you can type…
this.
As you hit the . all methods and events should appear, pick the event you after e.g. Load
Then add type += after the event name and press TAB TAB, the event is automatically generated. ASP.Net auto wires the events with the correct name and signature so you should be able to delete the line of code that binds the event.
Normally when you write a server control, .Net automatically wraps the output with a span and the Id of the control. Depending on your CSS this can cause rendering issues. You can use the following technique to prevent the span from being rendered.
public override void RenderBeginTag(HtmlTextWriter writer)
{
using (HtmlTextWriter blankOne = new HtmlTextWriter(new System.IO.StringWriter()))
{
base.RenderBeginTag(blankOne);
}
}
public override void RenderEndTag(HtmlTextWriter writer)
{
}
It basically writes out the open tag to a new HTML Writer and therefore is not part of the final rendered HTML