Friday, July 17, 2015

Response.Redirect causes System.Threading.ThreadAbortException

The correct way is to call the Redirect overload with endResponse=false and make a call to tell the IIS pipeline that it should directly to the EndRequest stage once you return control: So use endResponce to "false"

Response.Redirect(url, false);

Thursday, July 16, 2015

Tips for Better Work/Life Balance

  1. Limit nubber of hours you work for the day
  2. Take care of your self.
  3. Work is not everything in your life
  4. Do not be guilty of doing what you like.

Tuesday, October 21, 2014

Debugger not get attached - visual studio 2013

Debugger not get attached - visual studio 2013

This is a very common question some times developer came across.According to my experience this can be happens due to few reasons like,


  • You debugging badly build code 
  • You debugging some code it point to some other Dll
  • You debugging something but the code is something else.
  • You debugging the code but the dll it pointing might be a older one or not build properly.
  • May be your build symbols has not been attched and created properly when you build your code.


Solution:

its simple

Wednesday, January 30, 2013

Get All Site Roles - DNN

This is the code for get all site roles,


int portalId = portalSettings.PortalId;
ArrayList list = DotNetNuke.Security.Roles.RoleProvider.Instance().GetRoles(portalId);

Removing DNN Page By Code



Following is the code for remove DNN page from DNN portal.        

TabController tabController = new TabController();
          TabInfo tab= tabController.GetTabByName("FirstPage", -1);
           //-1- is for hot page 0 for portal page
           tabController.DeleteTab(tab.TabID, -1);


Thursday, December 6, 2012

Run command line code using code behind


Hi guys,

You may have face incidence like ruining a code segment using code behind, so check this code.
It use fro encrypt web config file connection string section by code behind executing comman line code

Command line code is:
aspnet_regiis.exe -pef “connectionStrings” C:\Projects\DemoApplication

So it can be run by code:

            var psi = new ProcessStartInfo(<aspnet_regiis.exe location>)
                {
                    Arguments = @"-pef ""connectionStrings"" "+'"'+<web config file location>+'"'+"",
                    UseShellExecute = false,
                    RedirectStandardOutput = false

                };
                Process.Start(psi);

cheers.


Thursday, June 14, 2012

Form Submission to another url from DNN module – cross site posting-POST/form in Asp.net


Hi All,
I’m posting this today I’m very sure that somebody will definitely help this.Coz I wasted some valuable time of mine for finding good solution for this.
Yes In Asp.Net you can’t nested forms.If you r using DNN the difficulty of using that is much more.So I was one of those L

Ok its like this.

You can create the form in code behind and send it via javascript.form action will set by javascript.

 StringBuilder htmlForm = new StringBuilder();
String paymentUrl=”Url of posting”;
            htmlForm.AppendLine(String.Format("<input type='hidden' name='itemQuantity1' value='1'>"));
            htmlForm.AppendLine(String.Format("<input type='hidden' name='itemPrice1' value='25000'>"));
            htmlForm.AppendLine(String.Format("<input type='hidden' name='validUntil' value='2012-01-28T12:00:00:000Z'>"));
            htmlForm.AppendLine("<input value=" + '"' + "Let's Pay Now" + '"' + "onclick=" + '"' + "this.form.method='post';this.form.content='text/html'; this.form.action='" + paymentUrl + "';this.form.submit();" + '"' + " type='submit' />");
            htmlCode.Text = htmlForm.ToString();


Ahh..remember to add that string of form in to asp Literal.

Try this guys! Leave a comment if you are happy!

Monday, April 16, 2012

Restore failed for Server ''

TITLE: Microsoft SQL Server Management Studio
------------------------------

Restore failed for Server ''.  (Microsoft.SqlServer.SmoExtended)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.5500.0+((Katmai_PCU_Main).110921-2358+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

System.Data.SqlClient.SqlError: The database was backed up on a server running version 10.50.2500. That version is incompatible with this server, which is running version 10.00.5500. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.5500.0+((Katmai_PCU_Main).110921-2358+)&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------
Solution : check this.

Thursday, March 22, 2012

The breakpoint will not currently be hit. No symbols have been loaded for this document

This is a common issue we facing in day today coding J I guess,This may occur due to may reason for easy understand I’ll explain few,

1-Your project has not build properly
2-Your project has not set to Debug project
3-PDB file may not been created –PBD is the file which contains all the symbols for related to the debug.
4-You may pointing different project but you need to debug is some another project. :)

Solution: check this