Recommended Posts

  • 2 months later...

Could you add daylight savings setting too.

btw c# example

public partial class Login : System.Web.UI.Page

{

private String NeowinLoginPage = "https://www.neowin.net/login/?url={0}";

private String NeowinTicketPage = "https://www.neowin.net/login/checkticket.php?ticket={0}";

protected void Page_Load(object sender, EventArgs e)

{

if (Request.QueryString.Get("ticket") != null)

{

System.Net.HttpWebRequest neowinRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(string.Format(NeowinTicketPage, Request.QueryString.Get("ticket")));

System.Net.HttpWebResponse neowinResponse = (System.Net.HttpWebResponse)neowinRequest.GetResponse();

System.IO.Stream receiveStream = neowinResponse.GetResponseStream();

System.Text.Encoding encode = System.Text.Encoding.GetEncoding("utf-8");

System.IO.StreamReader readStream = new System.IO.StreamReader(receiveStream, encode);

String SiteResponse = readStream.ReadToEnd();

readStream.Close();

neowinResponse.Close();

String[] NeowinData = SiteResponse.Split();

if (NeowinData[0] == "no")

{

Response.Write("Sorry, you could not be logged in, check your username and password.");

}

else

{

//Succesfully logged in.

Response.Write("You've been succesfully logged in..\n");

Response.Write("<br /><br />\n<strong>Username:</strong> " + NeowinData[1] + "<br />\n");

Response.Write("<strong>E-mail:</strong> " + NeowinData[2] + "<br />\n");

Response.Write("<strong>Group:</strong> " + NeowinData[5] + "<br />\n");

Response.Write("<strong>Member ID:</strong> " + NeowinData[4] + "<br />\n");

Response.Write("<strong>Time Offset:</strong> " + DateTime.UtcNow.AddHours(Convert.ToDouble(NeowinData[3])).ToLongTimeString());

}

}

else

{

Response.Redirect(String.Format(NeowinLoginPage, Request.Url.AbsoluteUri));

}

}

}

  • 1 year later...

Is it possible you can edit this so it doesn't strip out the URL encoded querystring?

When you pass a url that has index.php?page=whatever, the ?page=whatever gets stripped and that makes my program stop working. There's no way I can get around this as far as I know.

  • 2 weeks later...
  • 8 months later...

Done a HttpModule for ASP.NET:

Neowin.ExternalUser.zip

Make sure you do the module and configuration plumbing in your web.config:

&lt;?xml version="1.0"?&gt;
&lt;!-- 
	Note: As an alternative to hand editing this file you can use the 
	web admin tool to configure settings for your application. Use
	the Website-&gt;Asp.Net Configuration option in Visual Studio.
	A full list of settings and comments can be found in 
	machine.config.comments usually located in 
	\Windows\Microsoft.Net\Framework\v2.x\Config 
--&gt;
&lt;configuration&gt;
	&lt;configSections&gt;
		&lt;section name="neowin" type="Neowin.ExternalUser.NeowinExternalLoginConfigurationSection, Neowin.ExternalUser"/&gt;
	&lt;/configSections&gt;
	&lt;neowin myUrl="{your url here}"/&gt;
	&lt;appSettings/&gt;
	&lt;connectionStrings/&gt;
	&lt;system.web&gt;
		&lt;!-- 
			Set compilation debug="true" to insert debugging 
			symbols into the compiled page. Because this 
			affects performance, set this value to true only 
			during development.
		--&gt;
		&lt;compilation debug="true"/&gt;
		&lt;!--
			The &lt;authentication&gt; section enables configuration 
			of the security authentication mode used by 
			ASP.NET to identify an incoming user. 
		--&gt;
		&lt;authentication mode="Windows"/&gt;
		&lt;!--
			The &lt;customErrors&gt; section enables configuration 
			of what to do if/when an unhandled error occurs 
			during the execution of a request. Specifically, 
			it enables developers to configure html error pages 
			to be displayed in place of a error stack trace.

		&lt;customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"&gt;
			&lt;error statusCode="403" redirect="NoAccess.htm" /&gt;
			&lt;error statusCode="404" redirect="FileNotFound.htm" /&gt;
		&lt;/customErrors&gt;
		--&gt;
		&lt;httpModules&gt;
			&lt;add name="NeowinLoginModule" type="Neowin.ExternalUser.NeowinLoginModule, Neowin.ExternalUser"/&gt;
		&lt;/httpModules&gt;
	&lt;/system.web&gt;
&lt;/configuration&gt;

  • 9 months later...

We've made some changes to the script. The biggest thing is that it now uses the Finity style, and offers more details. Generally, it feels better.

The other thing is for developers of Neowin-based services. You can now pass &img=http://mydomain.com/neowin-login.png on the login URL, and that image will appear at the top left of the site, like so: https://www.neowin.net/login/?img=http://ww...ser%2Fticket%2F

It offers that extra bit of branding and clarity to the user.

The image you use should be 48px high, and only as wide as you need. There should be 2 or 3 pixels of padding around the image, so really the height is about 42px. Make sure it is a transparent PNG, so our background can be seen through it. Remember, you're branding Neowin, it better look nice :p

It's used for Neorequest, Shift Linux, and Ste's IRC logs. It just lets Neowin users log into an external site, without giving away their username and password, while the external site knows for certain that they are legitimate members.

It's used for Neorequest, Shift Linux, and Ste's IRC logs. It just lets Neowin users log into an external site, without giving away their username and password, while the external site knows for certain that they are legitimate members.

also for Quotes, and the Neowin Gamers Index (going to be doing some work on this at sometime or other).

It's used for Neorequest, Shift Linux, and Ste's IRC logs. It just lets Neowin users log into an external site, without giving away their username and password, while the external site knows for certain that they are legitimate members.

Good work Simon, hopefully we will be putting out a sweet new version of NeoRequest soon so I will whip up a decent logo for it.

Thanks

  • 2 weeks later...
  • 2 years later...
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.