|
Don't cross post, you have asked the same question in the C# forum.
|
|
|
|
|
hi
I want read the file base64 and show on the image control
thanks
|
|
|
|
|
Use a generic handler to read the base64 encoded image , decode it and output it to the browser. Feel free to use Session or Request to pass parameters to the handler to determine which file to read.
If you use ASP.NET 4 you can use the very convenient MemoryStream.CopyTo()-method, in versions below you'll have to do the copying yourself.
In your webform you can use it like this: <asp:Image ImageUrl="Base64ImageHandler.ashx" runat="server" /> (using the HTML img-element works too ofcourse)
<%@ WebHandler Language="C#" Class="Base64ImageHandler" %>
using System;
using System.Web;
using System.IO;
public class Base64ImageHandler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "image/jpeg";
string data64 = File.ReadAllText(@"e:\flotspe\www\images\5base64.txt");
byte[] data = Convert.FromBase64String(data64);
using (MemoryStream ms=new MemoryStream(data)) {
ms.CopyTo(context.Response.OutputStream);
}
}
public bool IsReusable {
get {
return false;
}
}
private static void CopyStream(Stream input, Stream output) {
byte[] buffer = new byte[32768];
while (true) {
int read = input.Read(buffer, 0, buffer.Length);
if (read <= 0)
return;
output.Write(buffer, 0, read);
}
}
}
|
|
|
|
|
As an alternative to using a generic handler you could also embed the base64-code directly into the src-attribute of the img element.
trivial example:
using System;
using System.IO;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e) {
string data64 = File.ReadAllText(@"e:\flotspe\www\images\5base64.txt");
this.form1.Controls.Add(new Image() { ImageUrl = string.Format("data:image/jpg;base64,{0}",data64) });
}
}
for more information about data URI scheme's see http://en.wikipedia.org/wiki/Data:_URI_scheme[^]
|
|
|
|
|
I am making simple board by using gridview.
gridview support page index and this function is good.
I am setting PageSize to 10.
1.
I want to add function which can move first page and last page.(<, >)
For example <(move first page) 1 2 3 4 >(move last page)
2. if pageSize is 2, and result row number is 100.
Pageindex will have many. such like blow.
1 2 3 4 5 6 7 8 9 10...
So i want to show 5 index such as 1 2 3 4 5 >
Is it possible?
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
buffering83 wrote: Is it possible?
Yes it is possible.
You need to create your own pager template (user control).
There are lot of good Article about paging here in Code Project.
Best luck.
|
|
|
|
|
hi
I want create html file form aspx file
|
|
|
|
|
Hi,
try this code below, if your page name is "signin.aspx" than
StringWriter sw = new StringWriter();
HttpContext.Current.Server.Execute("~/signin.aspx",sw,true);
String renderedHtml=sw.ToString();
|
|
|
|
|
Perhaps if you explained what is you are trying to accomplish we could assist you better.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
I am sorry for asking such an obvious question, and (frustratingly) I KNOW what I am looking for is on this website somewhere already, but could anyone be good enough to point me at a good article for writing a base page class for an ASP.NET base page?
Best wishes, Patrick
|
|
|
|
|
Have a look these links. Might be useful.
Link 1[^]
Link 2[^]
Regards,
TweakBird
***** Posted 50000th post in GIT O_O ******
|
|
|
|
|
Patrick Skelton wrote: I am looking for is on this website
I guess you missed this "on this website"
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: you missed this "on this website"
Yes. I missed it.
Regards,
TweakBird
***** Posted 50000th post in GIT O_O ******
|
|
|
|
|
|
Thanks for those links. Very useful. I think the one on 4GuysFromRolla was the one I read originally. I think I was mistaken about it being on CodeProject.
Thanks again.
Best wishes, Patrick
|
|
|
|
|
Patrick Skelton wrote: I think the one on 4GuysFromRolla was the one I read originally.
Next time, Bookmark it!
You can flame me whichever way you want and I wouldn't care a bit.
But if you group me with some idiots, I'll turn into your worst nightmare.
|
|
|
|
|
I thought I had. I am, however, human.
|
|
|
|
|
I use the following code in order to conncet my asp.net website to facebook
string appId = "xxx";
string[] extendedPermissions = new[] { "publish_stream", "offline_access" };
var oauth = new FacebookOAuthClient { AppId = appId };
var parameters = new Dictionary<string, object>
{
{ "response_type", "token" },
{ "display", "popup" }
};
if (extendedPermissions != null && extendedPermissions.Length > 0)
{
var scope = new StringBuilder();
scope.Append(string.Join(",", extendedPermissions));
parameters["scope"] = scope.ToString();
}
var loginUrl = oauth.GetLoginUrl(parameters);
Response.Redirect(loginUrl.AbsoluteUri);
but when I run this I get a login page(full page altough I set the display property to "popup"), and after login I redirected to a page which is not my website page(http://www.facebook.com/connect/login_success.html#access_token=xxx;expires_in=0). The page includes the word "succeed" only...
|
|
|
|
|
benams wrote: The page includes the word "succeed" only...
Then what can we do?
It's very hard to get response from CP about question related to FB. So you canask these question in FB forum then you can get more response.
http://forum.developers.facebook.net/[^]
Thanks
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
I read it supposed to take me back to the previous page so I could get information from the logged FB account.
|
|
|
|
|
Parwej Ahamad wrote: It's very hard to get response from CP about question related to FB
Even more difficult when the OP doesn't follow the forum guidelines and format any code posted.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Yes Mark, you are absolutely right.
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
Follow the forum guidelines and format your code, and you may receive more responses. If you can't follow the guidelines why should we read your question or help?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
I have an element name Sections under wich I have another element as Section as in the below code. When I deserialize this xml I am getting objects as section[0] etc. Can I make it to deserialize in the way that I can get it in the form of Key, Value pairs.
Any kind of help is greatly appreciated. Its urgent please help me. Its able to deserialize but I want it in the form of key, value pairs. Is it possible in the below scenario, any kind of help please appreciated.
XML File
<?xml version="1.0" encoding="utf-16"?> <DiffEngineConfig>
<Sections>
<Section Name="PersonalProfile=" Include="true=" />
<Section Name="PersonalProfileAddresses=" Include="false=" />
<Section Name="PersonalProfileAlerts=" Include="true=" />
<Section Name="PersonalProfileEmployments=" Include="false=" />
<Section Name="PersonalProfileNames=" Include="true=" />
<Section Name="PersonalProfileStatements=" Include="false=" />
<Section Name="ScoreDelta=" Include="true=" />
<Section Name="ScoreDeltaFactors=" Include="false=" />
<Section Name="NewPublicRecords=" Include="true=" />
<Section Name="ClosedCollections=" Include="false=" />
<Section Name="DerogatoryCollections=" Include="false=" />
<Section Name="RemovedCollections=" Include="true=" />
<Section Name="ClosedTradelines=" Include="false=" />
<Section Name="CreditLimitChanges=" Include="true=" />
<Section Name="DerogatoryTradelines=" Include="false=" />
<Section Name="NewAccounts=" Include="false=" />
<Section Name="RemovedTradelines=" Include="true=" />
<Section Name="NewInquiries=" Include="false=" />
</Sections>
<ValidationType Missing="false=" Extra="true=" />
</DiffEngineConfig>
Serializing classes
[Serializable]
[XmlRoot("DiffEngineConfig")]
public class DifferenceEngineConfig
{
[XmlElement("Sections")]
public Sections Sections
{ get; set; }
[XmlElement("ValidationType")]
public ValidationType ValidationType
{ get; set; }
}
[Serializable]
public class Sections
{
[XmlElement("Section")]
public List<Section> Section
{ get; set; }
}
[Serializable]
public class Section
{
[XmlAttribute("Name")]
public string Name
{ get; set; }
[XmlAttribute("Include")]
public bool Include
{ get; set; }
}
[Serializable]
public class ValidationType
{
[XmlAttribute("Missing")]
public bool Missing
{ get; set; }
[XmlAttribute("Extra")]
public bool Extra
{ get; set; }
}
Code to Serialize
private static DifferenceEngineConfig GetDifferenceEngineConfig(string strxml)
{
StringReader stringReader = new StringReader(strxml);
XmlTextReader xmlReader = new XmlTextReader(stringReader);
XmlSerializer _serializer = new XmlSerializer(typeof(DifferenceEngineConfig));
DifferenceEngineConfig differenceEngineConfig = (DifferenceEngineConfig)_serializer.Deserialize(xmlReader);
return differenceEngineConfig;
}
private static string ReadXmlFromFile(string fileFullPath)
{
string xml = string.Empty;
using (StreamReader reader = new StreamReader(fileFullPath))
{
xml = reader.ReadToEnd();
reader.Close();
}
return xml;
}
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
I am not very proficient with XML. However, my guess would be that you need to parse the data that you deserialize and place it into key/value pairs in that manner.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|