Regenerating SessionID in ASP.NET

Creating New ASP.NET_SessionId & Attaching Old ASP.NET_SessionId Values to New ASP.NET_SessionId

public void RegenerateSessionId()

{
System.Web.SessionState.SessionIDManager manager = new System.Web.SessionState.SessionIDManager();
string oldId = manager.GetSessionID(System.Web.HttpContext.Current);

string newId = manager.CreateSessionID(System.Web.HttpContext.Current);

bool isAdd = false, isRedir = false;
manager.SaveSessionID(System.Web.HttpContext.Current, newId, out isRedir, out isAdd);

HttpApplication ctx = (HttpApplication)HttpContext.ApplicationInstance;
HttpModuleCollection mods = ctx.Modules;
System.Web.SessionState.SessionStateModule ssm = (SessionStateModule)mods.Get(“Session”);
System.Reflection.FieldInfo[] fields = ssm.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
SessionStateStoreProviderBase store = null;
System.Reflection.FieldInfo rqIdField = null, rqLockIdField = null, rqStateNotFoundField = null;
foreach (System.Reflection.FieldInfo field in fields)
{
if (field.Name.Equals(“_store”)) store = (SessionStateStoreProviderBase)field.GetValue(ssm);
if (field.Name.Equals(“_rqId”)) rqIdField = field;
if (field.Name.Equals(“_rqLockId”)) rqLockIdField = field;
if (field.Name.Equals(“_rqSessionStateNotFound”)) rqStateNotFoundField = field;
}
object lockId = rqLockIdField.GetValue(ssm);
if ((lockId != null) && (oldId != null)) store.ReleaseItemExclusive(System.Web.HttpContext.Current, oldId, lockId);
rqStateNotFoundField.SetValue(ssm, true);
rqIdField.SetValue(ssm, newId);
}

UZVAL – Statistics – Total Hits-22,222, Total Visitors-6623, Total Posts – 93

Six years back I started posting certain postings in this blog for learning purpose.

Today it got 22,222 hits, Total Visitors-6623, Total Posts – 93.

During this tenure I had Learned a lot & Implemented my level best, Professionally & Personally.

Today i am feeling that i had completed one life cycle.

Heartful Thanks to My Well-Wishers who had given me good opportunities.

Now we all know lot of significant CHANGES (new versions, new libraries, new frameworks) evolved in .Net Stack.

Hope TOGETHER (Integrations & Collaborations) we learn and implement NEW needful CHANGES Professionally & Personally for a better life-style & society.

Sincerely,

Ujjwala Datta Kalluri.

uzval

If any Suggestion, please submit it below :

2015 in Review – Wish You Happy New Year

Wish You Happy Happy Happy New Year,

Time is free, but it’s priceless.
You can’t own it, but you can use it.
You can’t keep it, but you can spend it.
Once you’ve lost it, you can never get it back…

Years, Months, Weeks, Days, Hours , Minutes, Seconds… Its Transforming…

Hope we utilise our Time for well-being in a constructive way & we all have Good Health, Relationships, Prosperity, Contentment & Happiness.

Annual Report – 2015 for this blog

Here’s an excerpt:

In 2015 this blog was viewed about 5,300 times,

there were only 2 new posts,

The busiest day of the year was Apr 29th with 83 views.

Visitors are from 69 countries in all!

Most visitors came from India. The United States & The Srilanka.

Comma separated / delimited string to a table in SQL Server

Recently, I came across a piece of TSQL code that would take a comma separated string as an input and parse it to return a single column table from it.
CREATE FUNCTION [dbo].[UDF_string_to_table]

(
@string VARCHAR(8000),
@delimiter CHAR(1)
)
RETURNS @output TABLE(CommaSeparatedString VARCHAR(256))

BEGIN

DECLARE @start INT, @end INT
SELECT @start = 1, @end = CHARINDEX(@delimiter, @string)

WHILE @start < LEN(@string) + 1 BEGIN
IF @end = 0
SET @end = LEN(@string) + 1

INSERT INTO @output (CommaSeparatedString) VALUES(SUBSTRING(@string, @start, @end – @start))

SET @start = @end + 1
SET @end = CHARINDEX(@delimiter, @string, @start)
END

RETURN
END

Output:

select * from UDF_string_to_table(‘1,2,3′,’,’)

2014 in Review

Wish You Happy New Year, Just received this years corporate diary, it has… ” Every mountain top is within reach if you just keep climbing “ Annual Report – 2014 for this blog Here’s an excerpt: In 2014 this blog was viewed about 5,300 times, there were only 4 new posts, growing the total archive of this blog to 90 posts. There were 2 pictures uploaded, The busiest day of the year was Dec 3rd with 53 views. Visitors are from 96 countries in all! Most visitors came from India. The United States & The Brazil.

Power of Concentration :)

Unwavering Focus | Dandapani | TEDxReno

Sharpening the needle of concentration requires practice, like everything else in life.

Do you go to the gym? If you do, how many times a week and for how long?

Have you studied a foreign language? If you did, for how long did you practice, until you had a basic knowledge of the language?

It is the same with developing your concentration. You need training and practice.

Your mind does not like discipline, and will resist your efforts to discipline it. It loves its freedom more than anything else, and won’t let you master it. It will make you forget to do the exercises, tempt you to postpone performing them, or make you feel too lazy. It will find many tricks to occupy your attention with something else.

If you find it too difficult, or thoughts distract you and make you think about other matters, don’t despair. Everyone encounters difficulties along the way. If you persevere and never give up, in spite of difficulties and disturbances, success will crown your efforts.

How to Improve THIS :

  • Take Rest

The biggest factor affecting concentration is rest and this has been approved by research. Concentration requires your mind to be calm. But your mind will be scattered if you are not well rested. Make sure that you get the right amount of sleep at the right time. Also have regular sleep time, and this can be the key step for concentrating.

Sleeping too much is also not ideal. Oversleeping disrupts your natural rhythm and can make you lazy. Avoid this by having an alarm clock to wake you up in time.

  • Make a Plan

Always have a plan for whatever you are up to. When you sit down to work without a plan, you may easily get caught in activities like checking mails, Instant messaging (chatting) and browsing the web. Without a purpose, you are wasting your time. You’ll find yourself distracted by a variety of nagging thoughts instead of devoting all your attention to one important task.

To avoid this, make a clear plan that meets your needs beforehand. Take 5 or 10 minutes break in between, and use this time to check email, and then close your inbox and move on to your most important task. When making a plan be sure to allocate enough time for entertainment, studies and sleep.

  • Meditate

The practice of meditation will definitely improve our powers of concentration. Actually, when we try to meditate, it is concentration that is the first thing we need to master. A daily period of meditation gives us the chance to work specifically on concentration techniques.

  • Choose a place of your choice for concentration

Obviously some places are better than others. Libraries, study lounges and private rooms are the best. Above all, the place that you choose should not be distracting. Try to stay away from other people if you want to concentrate on your work.

  • Develop a controlled and balanced diet

Overeating creates a huge load of digestion and can make you feel uncomfortable and sleepy. Eating light and healthy meals can help you maximize your ability to concentrate.

  • Exercise frequently

The ability to concentrate depends a lot upon our physical well-being. If we are tired, unhealthy and afflicted by numerous minor ailments, concentration will be more difficult. However, we have to try to make life easy for ourselves; we need to give a high priority to our physical health:

  • Getting sufficient sleep
  • Staying physically fit
  • Maintaining healthy weight
  • Getting regular exercise
  • Take breaks and mix up your environment

Continuous work in the same place can drive anyone crazy. Taking constant breaks can solve the problem. This will make you active and more interested in your topic.

  • Know that practice makes perfect

Do you jog, exercise at the gym, or study a foreign language? How difficult it was when you first started? How many times you wanted to quit? Despite the difficulties, after a while, you started to like what you were doing. It became a habit, and did not require special effort. So it is with developing the power of concentration.

After some practice, it will be easier to concentrate, and your mind will learn to be calm and relaxed. People, circumstances, and events that used to agitate and anger you, will not disturb you. You will experience happiness and contentment, and gain self-confidence and inner strength. You will be able to cope more easily and efficiently with the outer world.

The fieldset attribute to logically group data items in Form.

The fieldset attribute is used to logically group data items that share some characteristics.
For example, you may wrap a fieldset around personal details, and another around work details,
when capturing information about a visitor in an application form.

Example:

<fieldset style=”border: 1px solid #ff8c00; padding: 10px; width: 224px;”>
<legend style=”font-weight: bold; background-color: #ffe4c4″>
// Heading
</legend>
<br />
// Content
<br />
</fieldset>

Image