Fetstil Fetstil Kursiv Understrykning linje färgläggning tabellverk Punktlista Nummerlista Vänster Centrerat högerställt Utfyllt Länk Bild htmlmode
  • Forum & Blog
    • Forum - översikt
      • .Net
        • asp.net generellt
        • c#
        • vb.net
        • f#
        • silverlight
        • microsoft surface
        • visual studio .net
      • databaser
        • sql-server
        • databaser
        • access
        • mysql
      • mjukvara klient
        • datorer och komponenter
        • nätverk, lan/wan
        • operativsystem
        • programvaror
        • säkerhet, inställningar
        • windows server
        • allmänt
        • crystal reports
        • exchange/outlook
        • microsoft office
      • mjukvara server
        • active directory
        • biztalk
        • exchange
        • linux
        • sharepoint
        • webbservers
        • sql server
      • appar (win/mobil)
      • programspråk
        • c++
        • delphi
        • java
        • quick basic
        • visual basic
      • scripting
        • asp 3.0
        • flash actionscript
        • html css
        • javascript
        • php
        • regular expresssion
        • xml
      • spel och grafik
        • DirectX
        • Spel och grafik
      • ledning
        • Arkitektur
        • Systemutveckling
        • krav och test
        • projektledning
        • ledningsfrågor
      • vb-sektioner
        • activeX
        • windows api
        • elektronik
        • internet
        • komponenter
        • nätverk
        • operativsystem
      • övriga forum
        • arbete karriär
        • erbjuda uppdrag och tjänster
        • juridiska frågor
        • köp och sälj
        • matematik och fysik
        • intern information
        • skrivklåda
        • webb-operatörer
    • Posta inlägg i forumet
    • Chatta med andra
  • Konto
    • Medlemssida
    • Byta lösenord
    • Bli bonsumedlem
    • iMail
  • Material
    • Tips & tricks
    • Artiklar
    • Programarkiv
  • JOBB
  • Student
    • Studentlicenser
  • KONTAKT
    • Om pellesoft
    • Grundare
    • Kontakta oss
    • Annonsering
    • Partners
    • Felanmälan
  • Logga in

Hem / Forum översikt / inlägg

Posta nytt inlägg


Padding is invalid

Postades av 2008-12-31 00:54:59 - Magnus Hallberg, i forum c# (c-sharp), Tråden har 7 Kommentarer och lästs av 918 personer

jag håller på med en applikation i Flash, jag har hittat en på nätet och tänkt göra om den så den passar mej. Det är en multi uppladdare, jag får ett märkligt fel. Lägger det inte i forumet för Flash då det troligen inte är i fLASH DET GÅR FEL.

"Ett fel inträffade den: den 31 december 2008klockan: 00:31

Sida: /WebResource.axd?d=TloVPZWpAzsTYTra4NsZuA2&t=633558206781406250

Meddelande: Padding is invalid and cannot be removed.

Källa: mscorlib

MetodInt32 DecryptData(Byte[], Int32, Int32, Byte[] ByRef, Int32, System.Security.Cryptography.PaddingMode, Boolean)

Stack Trace: at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast) at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) at System.Security.Cryptography.CryptoStream.FlushFinalBlock() at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo) at System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType) at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
"
Jag kan inte fatta detta. När jag kör applikatonen ensam i en egen mapp så fungerar det. När jag sedan lägger in den på min sida så får jag detta fel


Svara

Sv: Padding is invalid

Postades av 2008-12-31 09:29:32 - Oskar Johansson

Skicka med lite exempel på hur du gör


Svara

Sv:Padding is invalid

Postades av 2008-12-31 11:05:21 - Magnus Hallberg

Det är massor med kod. Men jag tror jag har fått fram att det har med Cookies att göra, eftersom Flash inte skickar Cookies så måste jag ha "<sessionState cookieless="UseUri" />" i Web.Config. Nu har jag använt Cookies innan på sidan och har följande inställning på RoleManager "<roleManager enabled="true" defaultProvider="roleProvider" cacheRolesInCookie="true" cookieName=".MyRolesCookie" cookieTimeout="30" cookieSlidingExpiration="true" cookieProtection="All">". Hur kan jag ändra det så det fortfarande fungerar? Har det någon betydelse att jag använder Cookies i JavaScript? Det ska det väl inte ha.


Svara

Sv: Padding is invalid

Postades av 2008-12-31 11:21:57 - Magnus Hallberg

Här är koden jag tror behövs

Web.Config
<code>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
<remove verb="POST,GET" path="Upload.axd"/>
<add verb="POST,GET" path="Upload.axd" type="Upload"/>
<remove verb="POST,GET" path="Upload2.axd"/>
<add verb="POST,GET" path="Upload2.axd" type="Upload2"/>
</httpHandlers>
</code>
.default.aspx
<code>
<body>
<form id="form1" runat="server">
<div>
<%--

The flash upload control. Source is located in the FlashUplod project with this solution.
The control encapsulates the creation of the flash object and embeds the .swf file
within the FlashUpload.dll.

Parameters:
UploadPage: the page to upload to. This can be a HttpHandler, an .aspx page, an .asp page;
any page that can accept uploaded files. This sample project uses a HttpHandler
which in my opinion is the best option.
OnUploadComplete: A javascript function which is called after all the files are uploaded.



--%>
<FlashUpload:FlashUpload ID="flashUpload" runat="server"
UploadPage="Upload.axd" OnUploadComplete="UploadComplete()"
FileTypeDescription="Images" FileTypes="*.gif; *.png; *.jpg; *.jpeg"
UploadFileSizeLimit="10485760" TotalUploadSizeLimit="41943040" />
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click"></asp:LinkButton>
</div>
</form>
</body>
</code>

.default.aspx.cs (Sidan jag laddar upp från)
<code>
protected void Page_Load(object sender, EventArgs e)
{
// example of forms based authentication
// check if user is authenticated because all files in folder are marked to allow
// anonymous access (see web.config in UploadPage folder). This is because of
// the flash bug that does not send cookies set in non IE browswers
if (!User.Identity.IsAuthenticated)
{
FormsAuthentication.RedirectToLoginPage();
return;
}
// allows the javascript function to do a postback and call the onClick method
// associated with the linkButton LinkButton1.
string jscript = "function UploadComplete(){" + ClientScript.GetPostBackEventReference(LinkButton1, "") + "};";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "FileCompleteUpload", jscript, true);

// Adds query string info to the upload page
// you can also do something like:
// we UrlEncode it because of how LoadVars works with flash,
// we want a string to show up like this 'CategoryID=3&UserID=4' in
// the uploadPage variable in flash. If we passed this string without
// UrlEncode then flash would take UserID as a seperate LoadVar variable
// instead of passing it into the uploadPage variable.
// then in the httpHandler we get the CategoryID and UserID values from
// the query string. See Upload.cs in App_Code
//flashUpload.QueryParameters = "categoryId=14"; // Server.UrlEncode(Request.QueryString.ToString());

// example use of cookieless sessions (flash does not send cookies set in non IE browswers
Session["temp"] = "hi";

// sends the identity of the user to the upload page using query string parameters. Used with forms authtication.
FormsIdentity cIdentity = User.Identity as FormsIdentity;
string encryptString = FormsAuthentication.Encrypt(cIdentity.Ticket);
flashUpload.QueryParameters = string.Format("User={0}", encryptString);
}

protected void LinkButton1_Click(object sender, EventArgs e)
{
// Do something that needs to be done such as refresh a gridView
// say you had a gridView control called gvMyGrid displaying all
// the files uploaded. Refresh the data by doing a databind here.
// gvMyGrid.DataBind();
}
</code>
.Upload.cs

<code>
public class Upload : IHttpHandler, IRequiresSessionState
{
public Upload()
{
}

#region IHttpHandler Members

public bool IsReusable
{
get { return true; }
}

public void ProcessRequest(HttpContext context)
{
// Example of using a passed in value in the query string to set a categoryId
// Now you can do anything you need to witht the file.
//int categoryId = 0;
//if (!string.IsNullOrEmpty(context.Request.QueryString["CategoryID"]))
//{
// int.TryParse(context.Request.QueryString["CategoryID"],out categoryId);
//}
//if (categoryId > 0)
//{
//}

string temp = context.Session["temp"].ToString();

string EncryptString = context.Request.QueryString["User"];
FormsAuthenticationTicket UserTicket = FormsAuthentication.Decrypt(EncryptString);

if (!UserTicket.Expired && context.Request.Files.Count > 0 )
{
// get the applications path

string uploadPath = context.Server.MapPath(context.Request.ApplicationPath + "/Upload");
// loop through all the uploaded files
for(int j = 0; j < context.Request.Files.Count; j++)
{
// get the current file
HttpPostedFile uploadFile = context.Request.Files[j];
// if there was a file uploded
if (uploadFile.ContentLength > 0)
{
// save the file to the upload directory

//use this if testing from a classic style upload, ie.

// <form action="Upload.axd" method="post" enctype="multipart/form-data">
// <input type="file" name="fileUpload" />
// <input type="submit" value="Upload" />
//</form>

// this is because flash sends just the filename, where the above
//will send the file path, ie. c:\My Pictures\test1.jpg
//you can use Test.thm to test this page.
//string filename = uploadFile.FileName.Substring(uploadFile.FileName.LastIndexOf("\\"));
//uploadFile.SaveAs(string.Format("{0}{1}{2}", tempFile, "Upload\\", filename));

// use this if using flash to upload
uploadFile.SaveAs(Path.Combine(uploadPath, uploadFile.FileName));

// HttpPostedFile has an InputStream also. You can pass this to
// a function, or business logic. You can save it a database:

//byte[] fileData = new byte[uploadFile.ContentLength];
//uploadFile.InputStream.Write(fileData, 0, fileData.Length);
// save byte array into database.

// something I do is extract files from a zip file by passing
// the inputStream to a function that uses SharpZipLib found here:
// http://www.icsharpcode.net/OpenSource/SharpZipLib/
// and then save the files to disk.
}
}
}
// Used as a fix for a bug in mac flash player that makes the
// onComplete event not fire
HttpContext.Current.Response.Write(" ");
}

#endregion
}
</code>


Svara

Sv:Padding is invalid

Postades av 2008-12-31 12:50:06 - Magnus Hallberg

Jaghar löst det:)

Jag skriver en förklaring senare.


Svara

Sv: Padding is invalid

Postades av 2009-01-01 14:51:55 - Magnus Hallberg

Det var sessionerna som ställde till det, Jag ändrade till "<sessionState cookieless="UseUri" />" så fungerade det.

Nu har jag en följdfråga, nu visas ju sessionsid(tror jag det är) i frågesträngen, kan man på nåt sätt gömma den så den inte syns? Det är ju kassa när man lägger till sidan till favoriter, då kommer ju sessionsid med och man får fel när man klickar på länken. Nu ser adressen ut så här i adressfältet.

"http://www.DOMÄN.COM/mh2/(S(zdjh4z55cegug445cccao4jx))/Default.aspx"


Svara

Sv:Padding is invalid

Postades av 2009-01-01 21:10:31 - Oskar Johansson

Kan du inte köra med cookies, men använda cookieless bara som url till din flash-fil?


Svara

Sv: Padding is invalid

Postades av 2009-01-01 21:13:56 - Magnus Hallberg

Hur gör jag det? Sätter enbart den urlen till cookielass? Urlen till sidan med flashfilen menar jag.


Svara

Nyligen

  • 08:28 Butiksskyltar: Hur upplever utbude
  • 22:31 Slappna av
  • 19:55 kick-off med fokus på hälsa?
  • 19:53 kick-off med fokus på hälsa?
  • 16:24 Föreslå en skönhetsklinik online
  • 16:23 Föreslå en skönhetsklinik online
  • 18:42 Hvor finder man håndlavede lamper
  • 18:41 Hvor finder man håndlavede lamper

Sidor

  • Hem
  • Bli bonusmedlem
  • Läs artiklar
  • Chatta med andra
  • Sök och erbjud jobb
  • Kontakta oss
  • Studentlicenser
  • Skriv en artikel

Statistik

Antal besökare:
Antal medlemmar:
Antal inlägg:
Online:
På chatten:
4 570 801
27 960
271 761
549
0

Kontakta oss

Frågor runt konsultation, rådgivning, uppdrag, rekrytering, annonsering och övriga ärenden. Ring: 0730-88 22 24 | pelle@pellesoft.se

© 1986-2013 PelleSoft AB. Last Build 4.1.7169.18070 (2019-08-18 10:02:21) 4.0.30319.42000
  • Om
  • Kontakta
  • Regler
  • Cookies