logo

The ConnectWise Control forum has moved to ConnectWise University! This forum has been locked and is in read-only mode. Click here for instructions on how to access the new forum.

Welcome Guest! You can not login or register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Guest  
#1 Posted : Sunday, May 23, 2010 10:31:25 PM(UTC)
Guest


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 4/9/2010(UTC)
Posts: 331

Was thanked: 2 time(s) in 2 post(s)
Can someone help me figure out the Guest.aspx please? Here is what I would like to do...

I am the only person that will use this and I can only work on 1 computer at a time so I only need 1 session ever created.

Instead of my client having to click a button to go to the next screen to only have to click the Run Program button, I would like it to just go right to that Run Program screen when I have started a session (as host).

I have modified the first page that shows to have a custom button (look here http://www.pclogin.info ) but I don't really want that screen to show at all. I want it to show the 2nd screen (the one after you press that button).

Everything I do causes an error in the program.


Thanks for your help.

Randy

UPDATE: I now know that I need to change the Guest.aspx.cs file to make it do what I want. However, I am still getting errors when trying. So I still need help please.

Another UPDATE: It seems that all I need to know how to do is get the current sessionID so it will start the 2nd page.

It's getting the current sessionID in this code that shows the first page...

this.multiView.SetActiveView(this.chooseView);
this.timer.Enabled = true;

var listedSessions = this.SessionManager.GetSessions(InvitationType.Listed);
this.sessionList.DataSource = listedSessions;
this.sessionList.DataBind();

this.codeView.Visible = (this.SessionManager.GetSessionCount(InvitationType.Code) != 0);
this.listedView.Visible = (listedSessions.Count != 0);
this.emptyView.Visible = (!this.codeView.Visible && !this.listedView.Visible);

this.timer.Interval = (this.codeView.Visible ? ServerConstants.WebInteractivePollInterval : ServerConstants.WebPollInterval);

But I can't seem to get it to just pass that sessionID to the part of the code I want it to show from the start, which is this part of the code...

else if (session.GetMostRelevantEventType(ProcessType.Guest) != SessionEventType.Connected)
{
this.multiView.SetActiveView(this.joinView);
this.timer.Enabled = true;
this.timer.Interval = ServerConstants.WebPollInterval;

var hostEventType = session.GetMostRelevantEventType(ProcessType.Host);
var hostMessageFormat = hostEventType == SessionEventType.Connected ? WebResources.JoinPanel_HostAlreadyJoinedMessage : WebResources.JoinPanel_HostNotYetJoinedMessage;
this.hostMessage.InnerHtml = string.Format(hostMessageFormat, session.Host);

var launchers = this.GetLaunchers(ProcessType.Guest);
var launcherInfos = new List<object>();

for (int i = 0; i < launchers.Count; i++)
{
var launcherScript = launchers[i].Key.GenerateClientScript(this, ProcessType.Guest, session);
launcherInfos.Add(new { LauncherScript = launcherScript, Name = launchers[i].Key.ToString(), Information = launchers[i].Value.Information });

if (i == 0)
{
this.runButton.Attributes.Add("onclick", launcherScript);
}
}

this.launcherList.DataSource = launcherInfos;
this.launcherList.DataBind();
}
else
{
this.multiView.SetActiveView(this.connectedView);
this.timer.Enabled = true;
this.timer.Interval = ServerConstants.WebPollInterval;
}
}

My problem is I am really good in PHP, and JAVA but this c# and asp.net I am having to learn now lol. Any help would be great!

Edited by user Monday, May 24, 2010 6:38:54 PM(UTC)  | Reason: Update

Jake  
#2 Posted : Tuesday, May 25, 2010 11:19:56 AM(UTC)
Jake


Rank: Administration

Medals: Level 4: Wise Old Owl! Received 100 Thanks!

Joined: 4/9/2010(UTC)
Posts: 2,061

Thanks: 1 times
Was thanked: 393 time(s) in 188 post(s)
You can try something like the following. Change this:

Code:
		protected override void OnLoad(EventArgs e)
		{
			base.OnLoad(e);

			var script = string.Format("if (event && event.keyCode == 13) {{ {0}.click(); return false; }}", this.invitationCodeButton.GetClientReference());
			this.invitationCodeBox.Attributes.Add("onkeypress", script);

			if (!this.IsPostBack)
			{
				var sessionIDQueryString = this.Request.QueryString[ServerConstants.SessionIDParameterName];
				var codeQueryString = this.Request.QueryString[ServerConstants.SessionCodeParameterName];

				if (!string.IsNullOrEmpty(sessionIDQueryString))
				{
					var sessionID = new Guid(sessionIDQueryString);
					this.ViewState[ServerConstants.SessionIDParameterName] = sessionID;
					Extensions.Try(delegate { this.SessionManager.AddSessionEvent(sessionID, ProcessType.Guest, SessionEventType.SelectedSession, null); });
				}
				else if (!string.IsNullOrEmpty(codeQueryString))
				{
					this.invitationCodeBox.Text = codeQueryString;
					this.TrySelectCode();
				}
			}
		}


To this:

Code:
		protected override void OnLoad(EventArgs e)
		{
			base.OnLoad(e);

			var script = string.Format("if (event && event.keyCode == 13) {{ {0}.click(); return false; }}", this.invitationCodeButton.GetClientReference());
			this.invitationCodeBox.Attributes.Add("onkeypress", script);

			if (!this.IsPostBack)
			{
				this.ViewState[ServerConstants.SessionIDParameterName] = this.SessionManager.GetSessions()[0];
			}
		}
ScreenConnect Team
Guest  
#3 Posted : Tuesday, May 25, 2010 5:13:13 PM(UTC)
Guest


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 4/9/2010(UTC)
Posts: 331

Was thanked: 2 time(s) in 2 post(s)
I changed that code and it gives an error. I don't know what the error is because it just shows the generic error screen.
Jake  
#4 Posted : Wednesday, May 26, 2010 10:46:25 AM(UTC)
Jake


Rank: Administration

Medals: Level 4: Wise Old Owl! Received 100 Thanks!

Joined: 4/9/2010(UTC)
Posts: 2,061

Thanks: 1 times
Was thanked: 393 time(s) in 188 post(s)
Do you have a session created? That code will fail unless there is at least one session created.

Also if you try it from the local machine, it should render a more accurate error message.
ScreenConnect Team
Guest  
#5 Posted : Wednesday, May 26, 2010 10:26:06 PM(UTC)
Guest


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 4/9/2010(UTC)
Posts: 331

Was thanked: 2 time(s) in 2 post(s)
Yes I have a session created. You are correct, doing it local showed the error. Here it is...



Server Error in '/' Application.
Type 'Elsinore.ScreenConnect.Session' in Assembly 'Elsinore.ScreenConnect.Server, Version=1.7.794.3789, Culture=neutral, PublicKeyToken=4b14c015c87c1ad8' is not marked as serializable.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.Serialization.SerializationException: Type 'Elsinore.ScreenConnect.Session' in Assembly 'Elsinore.ScreenConnect.Server, Version=1.7.794.3789, Culture=neutral, PublicKeyToken=4b14c015c87c1ad8' is not marked as serializable.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SerializationException: Type 'Elsinore.ScreenConnect.Session' in Assembly 'Elsinore.ScreenConnect.Server, Version=1.7.794.3789, Culture=neutral, PublicKeyToken=4b14c015c87c1ad8' is not marked as serializable.]
System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +7736011
System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +258
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +111
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +161
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +51
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +410
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +134
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) +13
System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +3158

[ArgumentException: Error serializing value 'Elsinore.ScreenConnect.Session' of type 'Elsinore.ScreenConnect.Session.']
System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +3370
System.Web.UI.ObjectStateFormatter.Serialize(Stream outputStream, Object stateGraph) +108
System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +58
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Serialize(Object state) +5
System.Web.UI.Util.SerializeWithAssert(IStateFormatter formatter, Object stateGraph) +37
System.Web.UI.HiddenFieldPageStatePersister.Save() +82
System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) +111
System.Web.UI.Page.SaveAllState() +818
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4375


Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016
Jake  
#6 Posted : Thursday, May 27, 2010 12:11:45 AM(UTC)
Jake


Rank: Administration

Medals: Level 4: Wise Old Owl! Received 100 Thanks!

Joined: 4/9/2010(UTC)
Posts: 2,061

Thanks: 1 times
Was thanked: 393 time(s) in 188 post(s)
Sorry, this should do it:

Code:

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var script = string.Format("if (event && event.keyCode == 13) {{ {0}.click(); return false; }}", this.invitationCodeButton.GetClientReference());
            this.invitationCodeBox.Attributes.Add("onkeypress", script);

            if (!this.IsPostBack)
            {
                this.ViewState[ServerConstants.SessionIDParameterName] = this.SessionManager.GetSessions()[0].SessionID;
            }
        }
ScreenConnect Team
Guest  
#7 Posted : Thursday, May 27, 2010 3:04:12 PM(UTC)
Guest


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 4/9/2010(UTC)
Posts: 331

Was thanked: 2 time(s) in 2 post(s)
That works great Jake. Thank you so much for that. You are right, without an open session it does show an error. I am going to work on a way to make it not show that error. If you come up with any ideas on how to make it just show the "No Sessions" that would be great. But it's doing just what I want it to do :) again thank you.

To anyone else reading this ---- This is the best program on the market. I love it, I use it, and the support is out of this world! I also have another tech that works for me and we bought the program for him as well. He loves it too! So if you are looking for this type of program, look no more, just go ahead and purchase this one! You will never regret that decision.

Sincerely,

Randy T.
The Electronic Geeks
Jake  
#8 Posted : Friday, May 28, 2010 10:33:29 AM(UTC)
Jake


Rank: Administration

Medals: Level 4: Wise Old Owl! Received 100 Thanks!

Joined: 4/9/2010(UTC)
Posts: 2,061

Thanks: 1 times
Was thanked: 393 time(s) in 188 post(s)
Something like this will solve your problem, and is much better practice:

Code:
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var script = string.Format("if (event && event.keyCode == 13) {{ {0}.click(); return false; }}", this.invitationCodeButton.GetClientReference());
            this.invitationCodeBox.Attributes.Add("onkeypress", script);

            if (!this.IsPostBack)
            {
                var sessions = this.SessionManager.GetSessions();

                if (sessions.Count != 0)
                    this.ViewState[ServerConstants.SessionIDParameterName] =sessions[0].SessionID;
            }
        }
ScreenConnect Team
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.